static private InitializeSyncRequest ( string collectionId, |
||
collectionId | string | Identify the folder as the collection being synchronized, which can be returned by ActiveSync FolderSync command(Refer to [MS-ASCMD]2.2.3.30.5) |
supported | Specifies which contact and calendar elements in a Sync request are managed by the client and therefore not ghosted. | |
return | SyncRequest |
internal static SyncRequest InitializeSyncRequest(string collectionId, Request.Supported supported)
{
Request.SyncCollection syncCollection = new Request.SyncCollection
{
Supported = supported,
WindowSize = "512",
CollectionId = collectionId,
SyncKey = "0"
};
List<object> items = new List<object>();
List<Request.ItemsChoiceType1> itemsElementName = new List<Request.ItemsChoiceType1>
{
Request.ItemsChoiceType1.BodyPreference
};
items.Add(
new Request.BodyPreference()
{
TruncationSize = 0,
TruncationSizeSpecified = false,
Type = 2,
Preview = 0,
PreviewSpecified = false,
});
Request.Options option = new Request.Options
{
Items = items.ToArray(),
ItemsElementName = itemsElementName.ToArray()
};
syncCollection.Options = new Request.Options[] { option };
SyncRequest request = Common.CreateSyncRequest(new Request.SyncCollection[] { syncCollection });
return request;
}
/// <summary> /// Initialize the sync with server /// </summary> /// <param name="collectionId">Specify the folder collection Id which needs to be synced.</param> /// <param name="supported">Specifies which contact and calendar elements in a Sync request are managed by the client and therefore not ghosted.</param> /// <returns>Return Sync response</returns> public SyncStore InitializeSync(string collectionId, Request.Supported supported) { // Obtains the key by sending an initial Sync request with a SyncKey element value of zero and the CollectionId element SyncRequest initializeSyncRequest = TestSuiteHelper.InitializeSyncRequest(collectionId, supported); SyncStore initializeSyncResponse = this.CALAdapter.Sync(initializeSyncRequest); // Verify sync result Site.Assert.AreEqual <byte>( 1, initializeSyncResponse.CollectionStatus, "If the Sync command executes successfully, the Status in response should be 1."); return(initializeSyncResponse); }