Monday, July 23, 2012

Specific file or folder name is too long in sharepoint

Here is the issue while we upload files or create folder to sharepoint document library.

Usually get an error saying that "Specific file or folder name is too long".

Reason : Every sharepoint file name has limited number of characters, It will check for this condition before upload file to sharepoint.

Solution : Sharepoint object model has provided a beauty of way to check for the file name validity.

Here is the code :



SPUrlUtility.IsLegalFileName(filename);


It will return weather all the conditions are passed before upload it to sharepoint.

No comments:

Post a Comment