4.2 Profile Replication

This scenario describes the protocol that is used to replicate the user profile information from one protocol server to another, for search engine crawling of user profiles, back-up, transfer, and so forth.

Initially, the protocol client retrieves the current change token to use as a starting point, and sends the following request:

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
     <GetCurrentChangeToken
 xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileChangeService"/>
   </soap:Body>
 </soap:Envelope>

The protocol server returns the current change token in the form of the following SOAP response:

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
     <GetCurrentChangeTokenResponse
 xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileChangeService">
       <GetCurrentChangeTokenResult>
         1;42703492;02/13/2008 14:34:56
       </GetCurrentChangeTokenResult>
     </GetCurrentChangeTokenResponse>
   </soap:Body>
 </soap:Envelope>

The protocol client uses the change token to retrieve all user profile change entries that occurred after the date and time of the specified change token, by sending the following request:

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
     <GetChanges
 xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileChangeService">
       <changeToken>
         1;42703492;02/13/2008 14:34:56
       </changeToken>
       <changeQuery>
         <SingleValueProperty>true</SingleValueProperty>
         <MultiValueProperty>true</MultiValueProperty>
         <Custom>true</Custom>
         <Anniversary>true</Anniversary>
         <DistributionListMembership>true</DistributionListMembership>
         <SiteMembership>true</SiteMembership>
         <QuickLink>true</QuickLink>
         <Colleague>true</Colleague>
         <PersonalizationSite>true</PersonalizationSite>
         <UserProfile>true</UserProfile>
         <OrganizationMembership>true</OrganizationMembership>
         <WebLog>true</WebLog>
         <Add>true</Add>
         <Update>true</Update>
         <UpdateMetadata>true</UpdateMetadata>
         <Delete>true</Delete>
       </changeQuery>
     </GetChanges>
   </soap:Body>
 </soap:Envelope>

The protocol server retrieves all user profile change entries that occurred after the specified change token and replies with the following response:

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
     <GetChangesResponse
 xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileChangeService">
       <GetChangesResult>
         <Changes>
           <UserProfileChangeData>
               <Id>42703511</Id>
               <UserAccountName>Another User4</UserAccountName>
               <ChangeType>Add</ChangeType>
               <ObjectType>Colleague</ObjectType>
               <EventTime>2008-02-13T14:34:56.183</EventTime>
               <Value xsi:type="xsd:string">One More User2</Value>
               <PolicyId>a88b9dcb-5b82-41e4-8a19-17672f307b95</PolicyId>
           </UserProfileChangeData>
           <UserProfileChangeData>
               <Id>42703578</Id>
               <UserAccountName>Another User4</UserAccountName>
               <ChangeType>Add</ChangeType>
               <ObjectType>WebLog</ObjectType>
               <EventTime>2008-02-13T15:45:07.183</EventTime>
               <PolicyId>a88b9dcb-5b82-41e4-8a19-17672f307b95</PolicyId>
           </UserProfileChangeData>
           <UserProfileChangeData>
               <Id>42703599</Id>
               <UserAccountName>Another User4</UserAccountName>
               <ChangeType>Delete</ChangeType>
               <ObjectType> WebLog </ObjectType>
               <EventTime>2008-02-13T16:56:18.183</EventTime>
               <PolicyId>a88b9dcb-5b82-41e4-8a19-17672f307b95</PolicyId>
           </UserProfileChangeData>
           <UserProfileChangeData>
               <Id>42703604</Id>
               <UserAccountName>User1</UserAccountName>
               <ChangeType>Add</ChangeType>
               <ObjectType>SingleValueProperty</ObjectType>
               <EventTime>2008-03-01T15:21:17.183</EventTime>
               <Value xsi:type="xsd:string">02/29/2008 </Value>
               <PolicyId>a88b9dcb-5b82-41e4-8a19-17672f307b95</PolicyId>
               <PropertyName>Marriage Data</PropertyName>
           </UserProfileChangeData>
         </Changes>
     <ChangeToken>1; 42703604;03/01/2008 15:21:17</ChangeToken>
     <HasExceededCountLimit>false</HasExceededCountLimit>
       </GetChangesResult>
     </GetChangesResponse>
   </soap:Body>
 </soap:Envelope>

The protocol client parses each UserProfileChangeData record and saves data according to its own storage mechanism, then uses the value of the ChangeToken node to initiate a new GetChanges request. If HasExceededCountLimit is true, not all user profile change entries have been retrieved and only the most recent ones have been sent. The protocol client will then reduce the time period between two consecutive GetChanges requests until HasExceededCountLimit is false, thus ensuring that no further data is lost.