Introducing the SharePoint object model
As an alternative to programming against the SharePoint web services you can use the SharePoint object model. The object model can be used when the application will run on the server where SharePoint...
View ArticleSPFolder / SPList: Deleting versus Recycling
The following code shows how to remove all documents from a folder: int iCount = spFolder.Files.Count; for (int i = 0; i < iCount; i++) { spFolder.Files[0].Delete(); } Deleting documents with...
View ArticleDocument Libraries: SPList and SPFolder.Delete Differences
Removing items from a document library can be done in two different ways. Firstly, using SPList.Delete: int iCount = spList.Items.Count; for (int i = 0; i < iCount; i++) {...
View ArticleExtract Public Key from Signed Assembly – Method 2
In this post I show how to extract the public key token from a signed assembly using the “sn” utility. If the signed assembly is already installed in the GAC you can use the Windows Explorer to find...
View ArticleSharePoint 2007 Custom Fields and “Edit property on server”
When developing custom fields in SharePoint 2007 you may encounter this warning when adding the field to a document library but not to a list: “The field type cannot be edited from most client programs...
View ArticleWhen an SPListItem won’t Update or Change
Here’s a problem that recently bit me. This code executes a query that returns a single SPListItem and then attempts to change the approved status through the SPListItemCollection: SPListItemCollection...
View ArticleTrimming WebPart Output with SPSecurityTrimmedControl
The SPSecurityTrimmedControl can be used in your SharePoint pages and web parts to conditionally display content based on permissions assigned to a user. Here’s an example of using the control in a web...
View ArticleCode for Creating New Documents based on a content type and template
This method “CreateDocument” will create a new document in a SharePoint document library using a content type. It will copy the document template associated with the content type into the new document:...
View ArticleWhen a SPFieldUserValueCollection won’t clear
Some time ago I wrote about problems with updating items through an item collection (see here). Well, here’s another similar problem that has bitten me, and it’s to do with updating a...
View ArticleOpening Web Parts Gallery Programmatically
Navigating to the Web Part Gallery in the browser interface takes you to http://site collection URL/_layouts/_catalogs/wp/Forms/AllItems.aspx. Attempting to open the list through “_catalogs/wp” will...
View Article
More Pages to Explore .....