SharePoint error message 0x8107026f

Interesting. For the first time in quite a while I'm programming agains SharePoint again. I am working on a possibility to upload files to a specific location in WSS, so the steps I need to make sure are:
- Check if the destination folder exist
- Create the destination folder if necessary
- Upload the file

In the process of creating the destination folder I do encounter a couple of error messages. The most interesting one is message 0x8107026f. Apparently nobody else on the internet has ever posted a question about this code before. My biggest online friends, Bing and Google, were not able to help me out here. But, I have been able to locate the issue and would like to share the cause and solution here.

The location where I do get this error message is in the last line of code:


batchNode.SetAttribute("RootFolder", rootFolder);
batchNode.InnerXml = xmlCommand;
XmlNode resultNode = listService.UpdateListItems(listName, batchNode);

the rootFolder in this case has been concatenated from the current location and the new desired destination folder. Apparently the UpdateListItems call can only create the last folder of the rootFolder. If you need to create more folders like a tree, then you would need to call this function multiple times. For example. If your root node is "My Files/Campaigns/Campaign x/Mail Merge Files" and the document library My Files does exist and in the Doc Lib there is a folder for Campaigns, but there is no folder for "Campaign x" yet, then this will need to be created first before the UpdateListItems could be called for "Mail Merge Files"

Some related error messages:

0x8107026f: The destination file or folder does not exist
0x81020073: The file or folder name contains characters that are not permitted
0x8107090d: The file or folder name does already exist
0x00000000: Succes
0x81020020: Invalid URL value A URL field contains invalid data. Please check the value and try again

The error code 0x81020020 can be caused because you are using a sitename in the webservice URL, but you have omitted to use the same name in the root folder.

6 comments:

Anonymous said...

Good stuff, thanks

Benoit said...

Thanks

Your last point helped me fix my issue (error code 0x81020020).
In rootfolder, this works for me :
- batchNode.SetAttribute("RootFolder", "http://///");

- batchNode.SetAttribute("RootFolder", "///");

Benoit said...

- batchNode.SetAttribute("RootFolder", "http://[server_name]/[site_name]/[list_name]/[folder_name]");
- batchNode.SetAttribute("RootFolder", "/[site_name]/[list_name]/[folder_name]");

Unknown said...

Thanks,

You saved my time! :)

venkatx5 said...

Thanks a lot for the Errorcodes. It drives me crazy!
-Venkatx5

Palash said...

Its helpful for me.Its saved my time