Saturday 29 January 2011

How to create a folder in a custom list

Very simple but can be very daunting if its not implemented with the correct logic. 


Use this code:
custLstObj.Folders.Add(parentFolderUrl, SPFileSystemObjectType.Folder, folderName);


Here's the details about the parameters
ParentFolderUrl: This is the url of the parent folder. For example if the folder is under main library then it should be '/lists/{listname}'
in case of sub folder this should be like '/lists/{listname}/{sub-fldername}'
SPFileSystemObjectType: Folder
folderName: actual name of the folder


if you use the 'Add' function with these parameters and perform 'UpdateOverWriteVersion' afterwards. The call to 'UpdateOverWriteVersion' function won't throw any exception.


Majid

No comments:

Iconise ‘Add Picture’ control in PowerApps

Default look you get for ‘Add Picture’ control is not very appealing for end user and there is no OTB way of specifying icon for this con...