/// <summary>
/// Builds a Sync add request by using the specified sync key, folder collection ID and add application data.
/// In general, returns the XMl formatted Sync request as follows:
/// <!--
/// <?xml version="1.0" encoding="utf-8"?>
/// <Sync xmlns="AirSync">
/// <Collections>
/// <Collection>
/// <SyncKey>0</SyncKey>
/// <CollectionId>5</CollectionId>
/// <GetChanges>1</GetChanges>
/// <WindowSize>152</WindowSize>
/// <Commands>
/// <Add>
/// <ServerId>5:1</ServerId>
/// <ApplicationData>
/// ...
/// </ApplicationData>
/// </Add>
/// </Commands>
/// </Collection>
/// </Collections>
/// </Sync>
/// -->
/// </summary>
/// <param name="collectionId">Specify the server ID of the folder to be synchronized, which can be returned by ActiveSync FolderSync command(Refer to [MS-ASCMD]2.2.3.30.5)</param>
/// <param name="syncKey">Specify the sync key obtained from the last sync response(Refer to [MS-ASCMD]2.2.3.166.4)</param>
/// <param name="addCalendars">Contains the data used to specify the Add element for Sync command(Refer to [MS-ASCMD]2.2.3.7.2)</param>
/// <returns>Returns the SyncRequest instance</returns>
internal static SyncRequest CreateSyncAddRequest(string collectionId, string syncKey, Request.SyncCollectionAddApplicationData addCalendars)
{
SyncRequest syncAddRequest;
Request.SyncCollectionAdd add = new Request.SyncCollectionAdd
{
ClientId = TestSuiteHelper.Next(),
ApplicationData = addCalendars
};
List <object> commandList = new List <object> {
add
};
// The Sync request include the GetChanges element of the Collection element will set to 0 (FALSE)
syncAddRequest = TestSuiteHelper.CreateSyncRequest(collectionId, syncKey, false);
syncAddRequest.RequestData.Collections[0].Commands = commandList.ToArray();
return(syncAddRequest);
}