Saturday, July 16, 2011

This might not be a super thing to blog but very important point to note. Through code I have tried to move a document from one document to another document by using file.MoveTo() operation. It was working very fine when I tested as I am administrator in the dev environment. But, when I have given to QA for testing it was failing. I have tried so many combinations of giving different access to them and nothing worked. When I have given them either Owners or site collection administrator access it started working. So, I was not understanding of what was the permission level do they need?
After tried different combinations of permission levels to them one matched and worked perfect. That was Contribute and Approve permission levels. So, for the logged in users who don't have both of these permission levels the code is failing for them and the  result file was not moving successful. [Another note is, I am using publishing site with auto approval of document in document library.]

Code used:
SPFile file = currentItem.File;
file.MoveTo(filePath, true);
For a document move operation the logged in user should need both Contributor and Approve permission levels for publishing web sites in SharePoint.

I am thinking it is correct according to my analysis and research. Please let me know if something is wrong in this post or any better solutions.
Categories: ,

1 comment:

  1. I am trying to do the same thing that is move a document to another folder on approval, can someone help me with the code. I am not a programmer, so your help is much appreciated.

    ReplyDelete