如何使用Power Automate HTTP请求将SharePoint Online中的用户字段设置为_vti_bin / client.svc / ProcessQuery?

问题描述

我试图弄清楚如何使用Power Automate在SharePoint中设置用户字段值。我需要使用SystemUpdate方法,因此不得不使用CSOM XML Request方法(_vti_bin / client.svc / ProcessQuery),但是我无法使其工作..

使用C#和提琴手生成XML以查看请求的外观,我得到了:

C:\Users\JUAN>pip3 install telethon

Collecting telethon
  Using cached Telethon-1.16.4-py3-none-any.whl (483 kB)
Collecting pyaes
  Using cached pyaes-1.6.1.tar.gz (28 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\juan\appdata\local\programs\python\python38-32\python.exe' -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'C:\\Users\\JUAN\\AppData\\Local\\Temp\\pip-install-i2of7eld\\pyaes\\setup.py'"'"'; __file__='"'"'C:\\Users\\JUAN\\AppData\\Local\\Temp\\pip-install-i2of7eld\\pyaes\\setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\JUAN\AppData\Local\Temp\pip-pip-egg-info-pffewwkh'
         cwd: C:\Users\JUAN\AppData\Local\Temp\pip-install-i2of7eld\pyaes\
    Complete output (24 lines):
    Traceback (most recent call last):
      File "c:\users\juan\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources\__init__.py",line 2867,in get_entry_map
        ep_map = self._ep_map
      File "c:\users\juan\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources\__init__.py",line 2825,in __getattr__
        raise AttributeError(attr)
    AttributeError: _ep_map

    During handling of the above exception,another exception occurred:

    Traceback (most recent call last):
      File "<string>",line 1,in <module>
      File "C:\Users\JUAN\AppData\Local\Temp\pip-install-i2of7eld\pyaes\setup.py",line 10,in <module>
        setup(name = 'pyaes',File "c:\users\juan\appdata\local\programs\python\python38-32\lib\distutils\core.py",line 108,in setup
        _setup_distribution = dist = klass(attrs)
      File "c:\users\juan\appdata\local\programs\python\python38-32\lib\site-packages\setuptools\dist.py",line 423,in __init__
        for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
      File "c:\users\juan\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources\__init__.py",line 657,in <genexpr>
        for entry in dist.get_entry_map(group).values()
      File "c:\users\juan\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources\__init__.py",line 2869,in get_entry_map
        ep_map = self._ep_map = EntryPoint.parse_map(
      File "c:\users\juan\appdata\local\programs\python\python38-32\lib\site-packages\pkg_resources\__init__.py",line 2550,in parse_map
        raise ValueError("Entry points must be listed in groups")
    ValueError: Entry points must be listed in groups
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

但是,如果我在Power Automate中使用该XML,则会抛出以下信息:

<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009">
<Actions>
    <Method Name="SetFieldValue" Id="41" ObjectPathId="30" Version="82">
        <Parameters>
            <Parameter Type="String">CosUser</Parameter>
            <Parameter TypeId="{c956ab54-16bd-4c18-89d2-996f57282a6f}">
                <Property Name="Email" Type="Null" />
                <Property Name="LookupId" Type="Int32">304</Property>
                <Property Name="LookupValue" Type="Null" />
            </Parameter>
        </Parameters>
    </Method>
    <Method Name="SystemUpdate" Id="42" ObjectPathId="30" Version="82" />
    <Query Id="43" ObjectPathId="30">
        <Query SelectAllProperties="false">
            <Properties>
                <Property Name="FileSystemObjectType" ScalarProperty="true" />
                <Property Name="Id" ScalarProperty="true" />
                <Property Name="ServerRedirectedEmbedUri" ScalarProperty="true" />
                <Property Name="ServerRedirectedEmbedUrl" ScalarProperty="true" />
                <Property Name="ContentTypeId" ScalarProperty="true" />
                <Property Name="_ModerationComments" ScalarProperty="true" />
                <Property Name="FileLeafRef" ScalarProperty="true" />
                <Property Name="Modified_x0020_By" ScalarProperty="true" />
                <Property Name="Created_x0020_By" ScalarProperty="true" />
                <Property Name="File_x0020_Type" ScalarProperty="true" />
                <Property Name="HTML_x0020_File_x0020_Type" ScalarProperty="true" />
                <Property Name="_SourceUrl" ScalarProperty="true" />
                <Property Name="_SharedFileIndex" ScalarProperty="true" />
                <Property Name="ComplianceAssetId" ScalarProperty="true" />
                <Property Name="Title" ScalarProperty="true" />
                <Property Name="TemplateUrl" ScalarProperty="true" />
                <Property Name="xd_ProgID" ScalarProperty="true" />
                <Property Name="xd_Signature" ScalarProperty="true" />
                <Property Name="_ShortcutUrl" ScalarProperty="true" />
                <Property Name="_ShortcutSiteId" ScalarProperty="true" />
                <Property Name="_ShortcutWebId" ScalarProperty="true" />
                <Property Name="_ShortcutUniqueId" ScalarProperty="true" />
                <Property Name="_dlc_DocId" ScalarProperty="true" />
                <Property Name="_dlc_DocIdUrl" ScalarProperty="true" />
                <Property Name="_dlc_DocIdPersistId" ScalarProperty="true" />
                <Property Name="Godk_x00e4_ndVersion" ScalarProperty="true" />
                <Property Name="Godk_x00e4_nt" ScalarProperty="true" />
                <Property Name="_ModerationStatus" ScalarProperty="true" />
                <Property Name="MediaServiceMetadata" ScalarProperty="true" />
                <Property Name="MediaServiceFastMetadata" ScalarProperty="true" />
                <Property Name="CosUser" ScalarProperty="true" />
                <Property Name="ID" ScalarProperty="true" />
                <Property Name="Created" ScalarProperty="true" />
                <Property Name="Author" ScalarProperty="true" />
                <Property Name="Modified" ScalarProperty="true" />
                <Property Name="Editor" ScalarProperty="true" />
                <Property Name="_HasCopyDestinations" ScalarProperty="true" />
                <Property Name="_CopySource" ScalarProperty="true" />
                <Property Name="FileRef" ScalarProperty="true" />
                <Property Name="FileDirRef" ScalarProperty="true" />
                <Property Name="Last_x0020_Modified" ScalarProperty="true" />
                <Property Name="Created_x0020_Date" ScalarProperty="true" />
                <Property Name="File_x0020_Size" ScalarProperty="true" />
                <Property Name="FSObjType" ScalarProperty="true" />
                <Property Name="SortBehavior" ScalarProperty="true" />
                <Property Name="CheckedOutUserId" ScalarProperty="true" />
                <Property Name="IsCheckedoutToLocal" ScalarProperty="true" />
                <Property Name="CheckoutUser" ScalarProperty="true" />
                <Property Name="UniqueId" ScalarProperty="true" />
                <Property Name="SyncClientId" ScalarProperty="true" />
                <Property Name="ProgId" ScalarProperty="true" />
                <Property Name="ScopeId" ScalarProperty="true" />
                <Property Name="VirusStatus" ScalarProperty="true" />
                <Property Name="CheckedOutTitle" ScalarProperty="true" />
                <Property Name="_CheckinComment" ScalarProperty="true" />
                <Property Name="MetaInfo" ScalarProperty="true" />
                <Property Name="_Level" ScalarProperty="true" />
                <Property Name="_IsCurrentVersion" ScalarProperty="true" />
                <Property Name="ItemChildCount" ScalarProperty="true" />
                <Property Name="FolderChildCount" ScalarProperty="true" />
                <Property Name="Restricted" ScalarProperty="true" />
                <Property Name="OriginatorId" ScalarProperty="true" />
                <Property Name="NoExecute" ScalarProperty="true" />
                <Property Name="ContentVersion" ScalarProperty="true" />
                <Property Name="_ComplianceFlags" ScalarProperty="true" />
                <Property Name="_ComplianceTag" ScalarProperty="true" />
                <Property Name="_ComplianceTagWrittenTime" ScalarProperty="true" />
                <Property Name="_ComplianceTagUserId" ScalarProperty="true" />
                <Property Name="BSN" ScalarProperty="true" />
                <Property Name="_ListSchemaVersion" ScalarProperty="true" />
                <Property Name="_Dirty" ScalarProperty="true" />
                <Property Name="_Parsable" ScalarProperty="true" />
                <Property Name="_StubFile" ScalarProperty="true" />
                <Property Name="_HasEncryptedContent" ScalarProperty="true" />
                <Property Name="AccessPolicy" ScalarProperty="true" />
                <Property Name="_VirusStatus" ScalarProperty="true" />
                <Property Name="_VirusVendorID" ScalarProperty="true" />
                <Property Name="_VirusInfo" ScalarProperty="true" />
                <Property Name="_CommentFlags" ScalarProperty="true" />
                <Property Name="_CommentCount" ScalarProperty="true" />
                <Property Name="_LikeCount" ScalarProperty="true" />
                <Property Name="_RmsTemplateId" ScalarProperty="true" />
                <Property Name="_IpLabelId" ScalarProperty="true" />
                <Property Name="_DisplayName" ScalarProperty="true" />
                <Property Name="_IpLabelAssignmentMethod" ScalarProperty="true" />
                <Property Name="A2ODMountCount" ScalarProperty="true" />
                <Property Name="AppAuthor" ScalarProperty="true" />
                <Property Name="AppEditor" ScalarProperty="true" />
                <Property Name="SMTotalSize" ScalarProperty="true" />
                <Property Name="SMLastModifiedDate" ScalarProperty="true" />
                <Property Name="SMTotalFileStreamSize" ScalarProperty="true" />
                <Property Name="SMTotalFileCount" ScalarProperty="true" />
                <Property Name="owshiddenversion" ScalarProperty="true" />
                <Property Name="_UIVersion" ScalarProperty="true" />
                <Property Name="_UIVersionString" ScalarProperty="true" />
                <Property Name="InstanceID" ScalarProperty="true" />
                <Property Name="Order" ScalarProperty="true" />
                <Property Name="GUID" ScalarProperty="true" />
                <Property Name="WorkflowVersion" ScalarProperty="true" />
                <Property Name="WorkflowInstanceID" ScalarProperty="true" />
                <Property Name="ParentVersionString" ScalarProperty="true" />
                <Property Name="ParentLeafName" ScalarProperty="true" />
                <Property Name="DocConcurrencyNumber" ScalarProperty="true" />
                <Property Name="ParentUniqueId" ScalarProperty="true" />
                <Property Name="StreamHash" ScalarProperty="true" />
            </Properties>
        </Query>
    </Query>
</Actions>
<ObjectPaths>
    <Identity Id="30" Name="70a7809f-e0f1-2000-3b39-606f7342ba2c|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:c8820382-1e83-42c7-81ba-911b2588b810:web:91a8bac3-5a81-47bb-abea-5797f7a4f9f8:list:ea4b0053-df63-468f-8e89-45891e1b68a2:item:1,1" />
</ObjectPaths>

我正在使用以下标题:

[
  {
    "SchemaVersion": "15.0.0.0","LibraryVersion": "16.0.20523.12005","ErrorInfo": {
      "ErrorMessage": "Unknown error","ErrorValue": null,"TraceCorrelationId": "6205819f-b00a-2000-4281-194024f5ab40","ErrorCode": -1,"ErrorTypeName": "Microsoft.SharePoint.Client.UnknownError"
    },"TraceCorrelationId": "6205819f-b00a-2000-4281-194024f5ab40"
  }
]

我到处都在寻找解决方案,但没有找到任何解决方法。有谁知道如何使用CSOM XML设置用户字段?

谢谢

弗雷德里克

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)