Category Archives: SharePoint Shorts

Create Zip File

SharePoint Short #17 Not so much a SharePoint post, but can be used in a SharePoint project, so counts for me 🙂 Using the WindowsBase assembly provides access to the System.IO.Packaging namespace and the PackagePart class. Using this class to … Continue reading

Posted in SharePoint Shorts | Tagged | Leave a comment

Get Default Database Infomation

SharePoint Short #15 Looking for a quick an easy way of retrieving the default content database information, like the SQL instance (i.e. servername\instance)? string sqlServerInstance = SPWebService.ContentService.DefaultDatabaseInstance.NormalizedDataSource;string sqlServerInstance = SPWebService.ContentService.DefaultDatabaseInstance.NormalizedDataSource; or individually string sqlInstance = SPWebService.ContentService.DefaultDatabaseInstance.Instance; string sqlServer = SPWebService.ContentService.DefaultDatabaseInstance.Server;string … Continue reading

Posted in SharePoint Shorts | Tagged | Leave a comment

Editing SPView objects

SharePoint Short #14 Making a change to a SPView object directly will not work: listObject.DefaultView.Title = "new title"; listObject.DefaultView.Update();listObject.DefaultView.Title = "new title"; listObject.DefaultView.Update(); What you should do is instantiate a new variable from the view you want to make changes … Continue reading

Posted in SharePoint Shorts | Tagged | Leave a comment

Handling Long Operations

SharePoint Short #13 Got some code that may take a while to complete? Good idea to let the user know they may have to wait a while, so put your code within the SPLongOperation block, as shown below, and it’s … Continue reading

Posted in SharePoint Shorts | Tagged | Leave a comment