public void AttachFileToSerializationItem(string itemPath, string filePath) { SyncItem syncItem = SyncItemProvider.GetSyncItem(itemPath); syncItem.AttachMediaFile(new FileInfo(filePath)); SyncItemProvider.SaveSyncItem(syncItem, itemPath); }
public void DetachFileFromSerializationItem(string itemPath) { SyncItem syncItem = SyncItemProvider.GetSyncItem(itemPath); syncItem.RemoveField(FileTemplateFields.Blob.FieldId); syncItem.SetFieldValue(FileTemplateFields.Size, String.Empty); syncItem.SetFieldValue(FileTemplateFields.Extension, String.Empty); syncItem.SetFieldValue(FileTemplateFields.MimeType, String.Empty); SyncItemProvider.SaveSyncItem(syncItem, itemPath); }
public SerializationFile DownloadFileFromSerializationItem(string itemPath) { SyncItem syncItem = SyncItemProvider.GetSyncItem(itemPath); string blobValue = syncItem.SharedValues[FileTemplateFields.Blob.FieldId]; string extension = syncItem.SharedValues[FileTemplateFields.Extension.FieldId]; byte[] fromBase64String = System.Convert.FromBase64String(blobValue); return(new SerializationFile(syncItem.Name, extension, fromBase64String)); }