public DataPackage UpdateRepeatProperty(ObjectIdentity objectIdentity) { PropertyProfile propertyProfile = new PropertyProfile(); // Setting the filter to ALL can cause errors if the DataObject // passed to the operation contains system properties, so to be safe // set the filter to ALL_NON_SYSTEM unless you explicitly want to update // a system property propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; DemoServiceContext.SetProfile(propertyProfile); DataObject dataObject = new DataObject(objectIdentity); String[] moreDangers = { "snakes", "sharks" }; ArrayProperty <string> keywordProperty = new StringArrayProperty("keywords", moreDangers); Console.WriteLine("Appending additional strings 'snakes' and 'sharks' to object keywords."); ValueAction appendAction = new ValueAction(ValueActionType.INSERT, 0); ValueAction deleteAction = new ValueAction(ValueActionType.APPEND, 1); keywordProperty.SetValueActions(appendAction, deleteAction); PropertySet properties = new PropertySet(); properties.Set(keywordProperty); dataObject.Properties = properties; OperationOptions operationOptions = null; return(objectService.Update(new DataPackage(dataObject), operationOptions)); }
public DataPackage UpdateFetchedObjectProperties(ObjectIdentity objectIdentity, String newTitle, String newSubject, String[] newKeywords) { PropertyProfile propertyProfile = new PropertyProfile(); // Setting the filter to ALL can cause errors if the DataObject // passed to the operation contains system properties, so to be safe // set the filter to ALL_NON_SYSTEM unless you explicitly want to update // a system property propertyProfile.FilterMode = PropertyFilterMode.ALL_NON_SYSTEM; DemoServiceContext.SetProfile(propertyProfile); OperationOptions operationOptions = null; DataPackage dP = objectService.Get(new ObjectIdentitySet(objectIdentity), operationOptions); DataObject dataObject = dP.DataObjects[0]; PropertySet properties = new PropertySet(); properties.Set("title", newTitle); properties.Set("subject", newSubject); properties.Set("keywords", newKeywords); dataObject.Properties = properties; return(objectService.Update(new DataPackage(dataObject), operationOptions)); }
public DataPackage CreateWithContentModifyContext(String filePath) { if (!File.Exists(filePath)) { throw new Exception("Test file: " + filePath + " does not exist"); } ContentTransferProfile transferProfile = new ContentTransferProfile(); transferProfile.TransferMode = ContentTransferMode.BASE64; Console.WriteLine("Modified service context: changed content transfer mode to BASE64 and Geolocation to 'Pleasanton'"); transferProfile.Geolocation = "Pleasanton"; DemoServiceContext.SetProfile(transferProfile); ObjectIdentity objIdentity = new ObjectIdentity(DefaultRepository); DataObject dataObject = new DataObject(objIdentity, "dm_document"); PropertySet properties = dataObject.Properties; properties.Set("object_name", "MyImage"); properties.Set("title", "MyImage"); properties.Set("a_content_type", "gif"); dataObject.Contents.Add(new FileContent(Path.GetFullPath(filePath), "gif")); OperationOptions operationOptions = null; return(objectService.Create(new DataPackage(dataObject), operationOptions)); }
public TypeInfo TypeInfoDemo() { SchemaProfile schemaProfile = new SchemaProfile(); schemaProfile.IncludeProperties = true; schemaProfile.IncludeValues = true; DemoServiceContext.SetProfile(schemaProfile); OperationOptions operationOptions = null; TypeInfo typeInfo = schemaService.GetTypeInfo(DefaultRepository, null, "dm_document", operationOptions); Console.WriteLine("Name: " + typeInfo.Name); Console.WriteLine("Label: " + typeInfo.Label); Console.WriteLine("Description: " + typeInfo.Description); Console.WriteLine("Parent name : " + typeInfo.ParentName); List<PropertyInfo> propertyInfoList; propertyInfoList = typeInfo.PropertyInfos; Console.WriteLine("Properties: "); foreach (PropertyInfo propertyInfo in propertyInfoList) { Console.WriteLine(" " + propertyInfo.Name); Console.WriteLine(" " + propertyInfo.DataType.ToString()); } return typeInfo; }
public FileInfo GetWithContent(ObjectIdentity objectIdentity, String geoLoc, ContentTransferMode transferMode, String objectID) { try { // Console.WriteLine("GetWithContent"); //ObjectId objectId = new ObjectId(objectID); //ObjectIdentity objectIdent = new ObjectIdentity(objectId, objectIdentity.RepositoryName); //ObjectIdentitySet objectIdentitySet = new ObjectIdentitySet(objectIdent); //DataPackage dataPackageas = objectService.Get(objectIdentitySet, null); ContentTransferProfile transferProfile = new ContentTransferProfile(); transferProfile.Geolocation = geoLoc; transferProfile.TransferMode = transferMode; DemoServiceContext.SetProfile(transferProfile); ContentProfile contentProfile = new ContentProfile(); contentProfile.FormatFilter = FormatFilter.ANY; contentProfile.UrlReturnPolicy = UrlReturnPolicy.PREFER; OperationOptions operationOptions = new OperationOptions(); operationOptions.ContentProfile = contentProfile; operationOptions.SetProfile(contentProfile); ObjectIdentitySet objectIdSet = new ObjectIdentitySet(objectIdentity); List <ObjectIdentity> objIdList = objectIdSet.Identities; objIdList.Add(objectIdentity); DataPackage dataPackage = objectService.Get(objectIdSet, operationOptions); DataObject dataObject = dataPackage.DataObjects[0]; Content resultContent = dataObject.Contents[0]; String contentClassName = resultContent.GetType().FullName; //Console.WriteLine("Returned content as type " + contentClassName); if (contentClassName.Equals("Emc.Documentum.FS.DataModel.Core.Content.UrlContent")) { UrlContent urlContent = (UrlContent)resultContent; // Console.WriteLine("Content ACS URL is: " + (urlContent.Url)); } if (resultContent.CanGetAsFile()) { FileInfo fileInfo = resultContent.GetAsFile(); return(fileInfo); //Console.WriteLine("Got content as file " + fileInfo.FullName); } else if (contentClassName.Equals("Emc.Documentum.FS.DataModel.Core.Content.UcfContent")) { UcfContent ucfContent = (UcfContent)resultContent; // Console.WriteLine("Got content as file " + ucfContent.LocalFilePath); } return(null); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); throw ex; } }