Monday, December 10, 2012

Add item in document library of spcific ContentType


SomeTimes you need to add item of type folder in Document Library Programatically and in this time you sould use SPFiles or you can add it as folder iten

Here is snapshots of code .....


 SPContentType mCType = InvoiceList.ContentTypes["YourCT"];                       
 SPFolder newFolder = InvoiceList.RootFolder.SubFolders.Add("yourFolderName") ;        newFolder.Item.SystemUpdate();   newFolder.Update();   newFolder.Item[SPBuiltInFieldId.ContentTypeId] = mCType.Id;
                       
 newFolder.Item["YourField"] = InvoiceAmountList[i];                     
 newFolder.Item.SystemUpdate();  InvoiceList.Update();  web.Update();

No comments:

Post a Comment