我目前有一個小問題,我不確定如何解決它。情況是這樣的。在SharePoint 2013中,我使用REST-API來更新和創建列表項目。SharePoint 2013 - 將用戶添加到UserInformationList
如果存在ppl-Picker,則值是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。當我現在發送第二請求後由基本上包含所有表單信息有些看起來像這樣
<?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":"[email protected]","Department":"XX-XX","Email":"[email protected]"},"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,因此我不太熟悉它的體系結構。如果你們中的某個人可以幫我在這裏,我會很高興
謝謝。我會盡力解決這個問題,並回到它是如何去的;) – Chris
有一件事情仍然是開放的。從People-Picker中,我只返回UserLogin。通過EnsureUser,我可以創建一個新用戶,但仍然存在一個問題,就是我沒有其他信息,比如部門,Tilte等。此API中是否還有一部分來獲取這些內容?我想我不知何故必須模仿第一次POST請求,但用登錄來獲得唯一的答案。我只是希望使用/ web/_api方法試圖用xml-body重建該請求,但我不確定輸入的一半是什麼意思 – Chris
似乎一旦用戶添加到了ppl選取器中,它們就會處於Active Directory。所以我想我現在必須找到一種方法來從Active Directory獲得用戶信息,其中包含給定的登錄名 – Chris