Geeks With Blogs
Fringe SharePoint Continued

I have been working with Folders, creating them and adding metadata to folders. Along with that I have chosen to implement the property bag for the "ID" for each folder. I guess I could have just used the "ID" as the metadata field in sharepoint, but I like the idea of property bags on sites, and thought I would implement it here as well.

I was experiencing something a little funny so I thought I would share, my result looks like this, when trying to create a folder and add metadata and the Id as the property.

it doesn't look like a folder at all. The code is as follows:

var folder = list.Folders.Add("", SpFileSystemObjectType.Folder, "trial");

folder["ContentType"] = "Custom Folder";

folder.Properties.Add("ID", "4");



for what ever reason it seems as though it doesn't like the fact that the property is being set. In order to fix this little problem I performed an update right after setting the content type and then another Update after adding the property(as shown in the code above). This seemed to create the folder and set the content type and then the property and have it saved as it should.

Pretty weird though

Posted on Monday, December 7, 2009 2:37 PM SharePoint | Back to top

Comments on this post: Another weird Content Type and property Quirk

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © juanlarios | Powered by: