Nick's profileSharePoint DevelopmentBlogListsNetwork Tools Help

Blog


    August 31

    Checking out a file on behalf of another user

    Over week or two I have been busy creating a custom sequential SharePoint Workflow using Visual Studio 2008.  The client requested that a new Document Workspace be created if a user were to select a custom link I added in the EditControlBlock in the dropdown menu for an item in a Document Library.  The steps are as follows:

    1. Create DocumentWorkspace.
    2. Assign Permissions to new workspace.
    3. Copy the document that was selected into the newly created site’s Shared Documents library.
    4. Checkout the original document in the library in which the workflow was activated.
    5. E-mail the owner and members that the site was created.

    Step 4 was proving to be quite difficult due to the fact that when you call SPFile.Checkout() in the SharePoint object model, it will always check the file out as the system administrator.  After trolling the various forums I managed to nail down this one method.

    image

    Every SharePoint object created and action taken after the impersonatedSiteCollection will be made under the context of the user that activated the workflow.  This way the original user has control over Checkin/Checkout going forward.

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://customsharepoint.spaces.live.com/blog/cns!41D760DBB8E4E638!185.trak
    Weblogs that reference this entry
    • None