none
workflow task approve error

    Question

  • HI,

    I have converted my sharepoint 2010 windows based application to sharepoint 2013 claims based site.

    I have a custom list to which I have attached a Visual studio workflow. In the workflow, I am removing the permission of all users and granting permission to specific users. This is working in SP 2010.

    For the list item, permission is set as "domain\username". In the SP 2013, for the list item, the user has permission, but he is not able to approve the task. I am getting the error as

    "System.ArgumentNullException: Value cannot be null.  Parameter name: item  
     at Microsoft.Office.Workflow.ListPage.SimpleNameFromItem(SPListItem item)   
     at Microsoft.Office.Workflow.WrkTaskIPPage.OnLoad(EventArgs ea)   
     at System.Web.UI.Control.LoadRecursive()   
     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)"

    If I remove the user, and add it as "I:0.w|domain\username", then the user is able to approve the task, but not with "domain\username". The code was working properly in SP 2010..

    How to fix this?

    Thanks

    Saturday, November 16, 2013 4:36 PM

Answers

  • Hi Venkatzeus,

    In classic mode, user identity is domainname/username, in claim mode, it adds claim identifier, like |:0.w|domainuser\name. as you convert the classic application to claim based application.  You need to convert the user account to claim identity, In the workflow, domainname/username in workflow shouldn’t be used, if you hard code it, an update to the workflow will be needed.

    If I have any misunderstanding, please feel free to point it out.

    Thanks,


    Qiao Wei
    TechNet Community Support

    • Marked as answer by Venkatzeus Thursday, November 21, 2013 1:13 PM
    Thursday, November 21, 2013 6:28 AM
    Moderator
  • Please try to convert username to claim encoded format:

                        var user = web.EnsureUser("domain\\user");
                        var userIdentifierEncodedClaim = SPClaimProviderManager.Local.ConvertSPUserToClaim(user);
                        var encodedClaimUserName = userIdentifierEncodedClaim.ToEncodedString();
    

    Then use the encodedClaimUsername instead of domain\user.


    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

    • Marked as answer by Venkatzeus Thursday, November 21, 2013 1:13 PM
    Thursday, November 21, 2013 6:59 AM

All replies

  • Hi Venkatzeus,

    In classic mode, user identity is domainname/username, in claim mode, it adds claim identifier, like |:0.w|domainuser\name. as you convert the classic application to claim based application.  You need to convert the user account to claim identity, In the workflow, domainname/username in workflow shouldn’t be used, if you hard code it, an update to the workflow will be needed.

    If I have any misunderstanding, please feel free to point it out.

    Thanks,


    Qiao Wei
    TechNet Community Support

    • Marked as answer by Venkatzeus Thursday, November 21, 2013 1:13 PM
    Thursday, November 21, 2013 6:28 AM
    Moderator
  • Please try to convert username to claim encoded format:

                        var user = web.EnsureUser("domain\\user");
                        var userIdentifierEncodedClaim = SPClaimProviderManager.Local.ConvertSPUserToClaim(user);
                        var encodedClaimUserName = userIdentifierEncodedClaim.ToEncodedString();
    

    Then use the encodedClaimUsername instead of domain\user.


    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

    • Marked as answer by Venkatzeus Thursday, November 21, 2013 1:13 PM
    Thursday, November 21, 2013 6:59 AM