我目前有一个小问题,我不太确定如何解决它。情况是这样的。在 SharePoint 2013 中,我使用 REST-API 来更新和创建列表项。
如果有 ppl-Picker,则 Values 是 UserInformationList 中用户的 Id。到目前为止,一切都很好。但现在这是我的问题。
这不适用于尚未在 UserInformationList 中的用户。当我搜索尚不存在的用户时,nativc 中的 SharePoint 似乎会以某种方式发出 POST 请求。鉴于到目前为止在 ppl 选择器中输入的字符串,第一个似乎从另一个列表中获取用户。身体是这样的
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName="Javascript Library">
<Actions>
<StaticMethod TypeId="{xxxxxxxxxxxxx}" Name="ClientPeoplePickerSearchUser" Id="5">
<Parameters>
<Parameter TypeId="{xxxxxxxxxxxxx}">
<Property Name="AllowEmailAddresses" Type="Boolean">false</Property>
<Property Name="AllowMultipleEntities" Type="Boolean">true</Property>
<Property Name="AllUrlZones" Type="Boolean">false</Property>
<Property Name="EnabledClaimProviders" Type="String" />
<Property Name="ForceClaims" Type="Boolean">false</Property>
<Property Name="MaximumEntitySuggestions" Type="Number">30</Property>
<Property Name="PrincipalSource" Type="Number">15</Property>
<Property Name="PrincipalType" Type="Number">1</Property>
<Property Name="QueryString" Type="String">jack</Property>
<Property Name="Required" Type="Boolean">false</Property>
<Property Name="SharePointGroupID" Type="Number">0</Property>
<Property Name="UrlZone" Type="Number">0</Property>
<Property Name="UrlZoneSpecified" Type="Boolean">false</Property>
<Property Name="Web" Type="Null" />
<Property Name="WebApplicationID" Type="String">{00000000-0000-0000-0000-000000000000}</Property>
</Parameter>
</Parameters>
</StaticMethod>
</Actions>
<ObjectPaths />
</Request>
然后它返回一个带有用户信息的 JSON。当我现在发送表单时,第二个 POST-Request 基本上包含所有的表单信息,看起来有点像这样
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="15.0.0.0" LibraryVersion="15.0.0.0" ApplicationName="Javascript Library">
<Actions>
<ObjectPath Id="3" ObjectPathId="2" />
<ObjectPath Id="5" ObjectPathId="4" />
<ObjectPath Id="7" ObjectPathId="6" />
<ObjectPath Id="9" ObjectPathId="8" />
<ObjectPath Id="11" ObjectPathId="10" />
<ExceptionHandlingScopeSimple Id="12">
<Method Name="ValidateUpdateListItem" Id="14" ObjectPathId="10">
<Parameters>
<Parameter Type="Array">
<Object TypeId="{xxxxxxxxxxx}">
<Property Name="ErrorMessage" Type="Null" />
<Property Name="FieldName" Type="String">Title</Property>
<Property Name="FieldValue" Type="String">___test</Property>
<Property Name="HasException" Type="Boolean">false</Property>
</Object>
<Object TypeId="{xxxxxxxxxxx}">
<Property Name="ErrorMessage" Type="Null" />
<Property Name="FieldName" Type="String">Someone</Property>
<Property Name="FieldValue" Type="String" />
<Property Name="HasException" Type="Boolean">false</Property>
</Object>
<Object TypeId="{xxxxxxxxxxx}">
<Property Name="ErrorMessage" Type="Null" />
<Property Name="FieldName" Type="String">LookupField</Property>
<Property Name="FieldValue" Type="String" />
<Property Name="HasException" Type="Boolean">false</Property>
</Object>
<Object TypeId="{xxxxxxxxxxx}">
<Property Name="ErrorMessage" Type="Null" />
<Property Name="FieldName" Type="String">SomeTextField</Property>
<Property Name="FieldValue" Type="String" />
<Property Name="HasException" Type="Boolean">false</Property>
</Object>
<Object TypeId="{xxxxxxxxxxx}">
<Property Name="ErrorMessage" Type="Null" />
<Property Name="FieldName" Type="String">APerson</Property>
<Property Name="FieldValue" Type="String">[{"Key":"i:0#.w|dom\\xxxxxx","Description":"DOM\\xxxxx","DisplayText":"Some, Name","EntityType":"User","ProviderDisplayName":"Active Directory","ProviderName":"AD","IsResolved":true,"EntityData":{"Title":"","MobilePhone":"","SIPAddress":"some.person@mail.com","Department":"XX-XX","Email":"some.person@mail.com"},"MultipleMatches":[],"AutoFillKey":"i:0#.w|dom\\xxxxxxx","AutoFillDisplayText":"Person, Some","AutoFillSubDisplayText":"","AutoFillTitleText":"SomeString","DomainText":"some.domain.net","Resolved":true,"LocalSearchTerm":"some"}]</Property>
<Property Name="HasException" Type="Boolean">false</Property>
</Object>
<Object TypeId="{xxxxxxxxxxx}">
<Property Name="ErrorMessage" Type="Null" />
<Property Name="FieldName" Type="String">ContentType</Property>
<Property Name="FieldValue" Type="String">Element</Property>
<Property Name="HasException" Type="Boolean">false</Property>
</Object>
<Object TypeId="{xxxxxxxxxxx}">
<Property Name="ErrorMessage" Type="Null" />
<Property Name="FieldName" Type="String">ContentTypeId</Property>
<Property Name="FieldValue" Type="String">0x010020785F18D738D74797A0C6B07438E69E</Property>
<Property Name="HasException" Type="Boolean">false</Property>
</Object>
</Parameter>
<Parameter Type="Boolean">false</Parameter>
<Parameter Type="Null" />
</Parameters>
</Method>
</ExceptionHandlingScopeSimple>
</Actions>
<ObjectPaths>
<StaticProperty Id="2" TypeId="{xxxxxxxxxxx}" Name="Current" />
<Property Id="4" ParentId="2" Name="Web" />
<Property Id="6" ParentId="4" Name="Lists" />
<Method Id="8" ParentId="6" Name="GetById">
<Parameters>
<Parameter Type="String">xxxxxxxxxxx</Parameter>
</Parameters>
</Method>
<Method Id="10" ParentId="8" Name="AddItem">
<Parameters>
<Parameter TypeId="{xxxxxxxxxxx}">
<Property Name="FolderUrl" Type="String">/sites/site/lists/theList</Property>
<Property Name="LeafName" Type="Null" />
<Property Name="UnderlyingObjectType" Type="Number">0</Property>
</Parameter>
</Parameters>
</Method>
</ObjectPaths>
</Request>
这第二篇文章似乎也以某种方式在 UserInformationList 中创建了用户。所以我的问题是。
有没有办法创建 UserInformationList 中尚不存在的用户并在创建后取回他们的 ID?
由于我只在前端开发了 SharePoint,所以我对它的架构不太熟悉。如果你们中的某个人可以在这里帮助我,那就太好了