private static HierarchySyncMetadataItem Create(StoreSession session, StoreId folderId)
        {
            HierarchySyncMetadataItem hierarchySyncMetadataItem = ItemBuilder.CreateNewItem <HierarchySyncMetadataItem>(session, folderId, ItemCreateInfo.HierarchySyncMetadataInfo, CreateMessageType.Associated);

            hierarchySyncMetadataItem[StoreObjectSchema.ItemClass] = "IPM.HierarchySync.Metadata";
            return(hierarchySyncMetadataItem);
        }
 public static HierarchySyncMetadataItem.SyncMetadataAttachmentStream CreateAttachment(HierarchySyncMetadataItem item, string attachmentName, bool overrideIfExisting)
 {
     ArgumentValidator.ThrowIfNull("item", item);
     ArgumentValidator.ThrowIfNullOrWhiteSpace("attachmentName", attachmentName);
     using (StreamAttachment streamAttachment = item.GetStreamAttachment(attachmentName))
     {
         if (streamAttachment != null)
         {
             if (!overrideIfExisting)
             {
                 HierarchySyncMetadataItem.Tracer.TraceDebug(0L, "SyncMetadataAttachmentStream:CreateAttachment - Skiping creation of sync state attachment and one already exist and override was not selected");
                 return(null);
             }
             item.DeleteAttachment(attachmentName);
         }
     }
     return(HierarchySyncMetadataItem.SyncMetadataAttachmentStream.Instantate(item.CreateStreamAttachment(attachmentName), StreamBase.Capabilities.Writable));
 }
 public static HierarchySyncMetadataItem.SyncMetadataAttachmentStream GetExistingAttachment(HierarchySyncMetadataItem item, string attachmentName, StreamBase.Capabilities streamCapabilities)
 {
     ArgumentValidator.ThrowIfNull("item", item);
     ArgumentValidator.ThrowIfNullOrWhiteSpace("attachmentName", attachmentName);
     return(HierarchySyncMetadataItem.SyncMetadataAttachmentStream.Instantate(item.GetStreamAttachment(attachmentName), streamCapabilities));
 }