PWA PSI statusingclient.UpdateStatus更新任务页面的AssnCustomFields的TextValue值

1、注意Changesxml格式和下面一定要一样
2、CustomFieldGuid和CustomFieldName都不能少,自定义域的uid和name其中uid或者是MD_PROP_UID_SECONDARY,CustomFieldGuid和自定义域的CustomFieldGuid不一样
3、摸索老长时间才OK,不易呀
         

StatusingSvc.Statusing statusingclient = new StatusingSvc.Statusing(); statusingclient.Url = "http://localhost:8888/PWA/_vti_bin/psi/Statusing.asmx"; statusingclient.Credentials = new NetworkCredential("spadmin13", "123456", "spdev.com"); StatusingSvc.StatusingDataSet statu_dst = statusingclient.ReadStatus(new Guid("bac28f5b-2bda-e511-82f5-463500000031"), DateTime.MinValue, DateTime.MaxValue); StatusingSvc.StatusingDataSet.AssnCustomFieldsDataTable ass_cus_tb = statu_dst.AssnCustomFields; //ass_cus_tb[0].TEXT_VALUE = "hello"; string xmldate = @"<Changes> <Proj ID=""49e853c7-2bda-e511-82f5-463500000031""> <Assn ID=""bac28f5b-2bda-e511-82f5-463500000031""> <SimpleCustomFieldChange CustomFieldType=""Text"" CustomFieldGuid=""fc30a9b1-2cda-e511-812a-00155d710610"" CustomFieldName=""交付物完成情况"">hello123</SimpleCustomFieldChange> </Assn> </Proj> </Changes>"; statusingclient.UpdateStatus(xmldate);

上面的代码有点问题出现一个错误
Services.Protocols.SoapException: ProjectServerError(s) LastError=GeneralSecurityAccessDenied Instructions: Pass this into PSClientError constructor to access all error information

缺少resourceuid

<Changes>

    <Proj ID="49e853c7-2bda-e511-82f5-463500000031">

        <Assn ID="3f1b99c5-a8ec-e511-82fe-68f7288204f4" ResID="99d92f87-a7ec-e511-812f-00155d710610">

            <SimpleCustomFieldChange CustomFieldType="Text" CustomFieldGuid="fc30a9b1-2cda-e511-812a-00155d710610" CustomFieldName="交付物完成情况">100%</SimpleCustomFieldChange>

        </Assn>
    </Proj>
</Changes>
 
原文地址:https://www.cnblogs.com/systemnet123/p/5239198.html