none
C# PSI How to Check if Resource has "Resource can logon to Project Server" Selected RRS feed

Answers

  • Hello, What about seeing if a resource has a value in the wres account field? http://msdn.microsoft.com/en-us/library/office/websvcresource.resourcedataset.resourcesdatatable.wres_accountcolumn_di_pj14mref(v=office.14).aspx Paul

    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS

    • Proposed as answer by Kashif Nizam Monday, April 29, 2013 11:53 AM
    • Marked as answer by Paul MC2 Monday, April 29, 2013 2:43 PM
    Saturday, April 27, 2013 9:10 AM
    Moderator
  • To anyone that cares,

    The call:

    resourceWS.SetResourceAuthorization

    Is the call that checks the "Resource can logon to Project Server" check box. This method takes a Resource Authorization data set as a parameter:

    ResourceWS.ResourceAuthorizationDataSet resourceAuthDs = new ResourceWS.ResourceAuthorizationDataSet(); ResourceWS.ResourceAuthorizationDataSet.ResourcesRow resourceAuthRow = resourceAuthDs.Resources.NewResourcesRow(); resourceAuthRow.RES_UID = resourceUid; resourceAuthRow.WRES_ACCOUNT = account; resourceAuthRow.RES_IS_WINDOWS_USER = isWindowsUser; resourceAuthRow.RES_PREVENT_ADSYNC = preventADsync; resourceAuthDs.Resources.AddResourcesRow( resourceAuthRow );

    Whichever account you specify in the above authorization data set is automatically assigned as the domain name of the resource, so there is no need to assign the domain name to the resources WRES_ACCOUNT property.

    In conclusion:
    To check if a resource has authority to log on, check the resources WRES_ACCOUNT property. If the value is not null, then the user has authority.

    To check the "Resource can logon to Project Server" check box from code, call the resourceWS.SetResourceAuthorization method, and pass in a ResourceAuthorizationDataSet as a parameter (example above)


    120811049008

    • Marked as answer by Paul MC2 Monday, April 29, 2013 2:43 PM
    Monday, April 29, 2013 2:42 PM

All replies

  • Hello, What about seeing if a resource has a value in the wres account field? http://msdn.microsoft.com/en-us/library/office/websvcresource.resourcedataset.resourcesdatatable.wres_accountcolumn_di_pj14mref(v=office.14).aspx Paul

    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS

    • Proposed as answer by Kashif Nizam Monday, April 29, 2013 11:53 AM
    • Marked as answer by Paul MC2 Monday, April 29, 2013 2:43 PM
    Saturday, April 27, 2013 9:10 AM
    Moderator
  • Thanks for the reply Paul,

    That's seems to work well. For all resources that do not have authority to log on their domain account property is null.

    So as an added bonus... how do I check this flag (activate it). When I try to assign a domain name to this null WRES_ACCOUNT field there is an error saying "Property is read only". I can assign a domain account to users that do have authority to log on, but I cannot assign a domain account to a user that does not have authority to log on.

    I am sensing a bit of a chicken-->egg sequence here. So plainly, how do I set a "Resource can logon to Project Server" checkbox from code for a resource?


    120811049008

    Monday, April 29, 2013 12:39 PM
  • To anyone that cares,

    The call:

    resourceWS.SetResourceAuthorization

    Is the call that checks the "Resource can logon to Project Server" check box. This method takes a Resource Authorization data set as a parameter:

    ResourceWS.ResourceAuthorizationDataSet resourceAuthDs = new ResourceWS.ResourceAuthorizationDataSet(); ResourceWS.ResourceAuthorizationDataSet.ResourcesRow resourceAuthRow = resourceAuthDs.Resources.NewResourcesRow(); resourceAuthRow.RES_UID = resourceUid; resourceAuthRow.WRES_ACCOUNT = account; resourceAuthRow.RES_IS_WINDOWS_USER = isWindowsUser; resourceAuthRow.RES_PREVENT_ADSYNC = preventADsync; resourceAuthDs.Resources.AddResourcesRow( resourceAuthRow );

    Whichever account you specify in the above authorization data set is automatically assigned as the domain name of the resource, so there is no need to assign the domain name to the resources WRES_ACCOUNT property.

    In conclusion:
    To check if a resource has authority to log on, check the resources WRES_ACCOUNT property. If the value is not null, then the user has authority.

    To check the "Resource can logon to Project Server" check box from code, call the resourceWS.SetResourceAuthorization method, and pass in a ResourceAuthorizationDataSet as a parameter (example above)


    120811049008

    • Marked as answer by Paul MC2 Monday, April 29, 2013 2:43 PM
    Monday, April 29, 2013 2:42 PM