New-SPLogFile

SharePoint, Tools
One of the common scenarios when troubleshooting a SharePoint solution is to look in the ULS logs for the lines that are marked with a specfic corellation identifier. However, log files can become quite large over time and the...
Continue Reading

Project Server 2013 Remote Event Handlers

Code Samples, Office 365, Project Server, SharePoint
A new feature in Project Server 2013 is the Remote Event Handlers. Those who worked with 2010 version know that to write a server event one needed to: – create an assembly containing the server event handlers – create...
Continue Reading

Authenticating in Office 365

Code Samples, Office 365, SharePoint
The following SharePoint 2013 code will connect to Office 365 and load the Web properties using CSOM: ClientContext spctxt = new ClientContext(url); SharePointOnlineCredentials cred = new SharePointOnlineCredentials(username, SecureStringFromString(password)); spctxt.Credentials = cred; spctxt.Load(spctxt.Web); spctxt.ExecuteQuery(); For both 2013 and 2010 versions,...
Continue Reading

Copying a site collection.

Code Samples, SharePoint
Sometimes it is useful to copy over a site collection (SPSite) from a WebApplication to another. This can be easily accomplished in just a few lines of code:  static void Main(string args)         {             String url1 = "http://web1/sitecollection1";             String url2 = "http://web2/sitecollection2";             SPWebApplication webApp1 = SPWebApplication.Lookup(new Uri(url1));             SPWebApplication webApp2 = SPWebApplication.Lookup(new Uri(url2));             webApp1.Sites.Backup(url1, "c:\temp\site.backup", true);                         webApp2.Sites.Restore(url2, "c:\temp\site.backup", true);                     }
Continue Reading

Changing the site owner of a PWA instance used by Project Financial Server

Project Financial Server, SharePoint
The user account specified as site owner for the web application used by the Project Web App site is employed by Project Financial Server for a wide variety of internal operations involving the PSI. The site owner user account...
Continue Reading