Esempio n. 1
0
        public DataPackage UpdateObjectProperties(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;
            OperationOptions operationOptions = new OperationOptions();

            operationOptions.SetProfile(propertyProfile);

            DataObject dataObject = new DataObject(objectIdentity);

            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));
        }
Esempio n. 2
0
        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;
            }
        }
        public DataObject GetWithContent(ObjectIdentity objectIdentity, String geoLoc, ContentTransferMode transferMode)
        {
            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();
            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();
                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 dataObject;
        }
        public DataPackage UpdateObjectProperties(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;
            OperationOptions operationOptions = new OperationOptions();
            operationOptions.SetProfile(propertyProfile);

            DataObject dataObject = new DataObject(objectIdentity);

            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);
        }
Esempio n. 5
0
        private OperationOptions GetOperationOptionsForRetrievingContent()
        {
            var contentProfile = new ContentProfile
                                 {
                                     FormatFilter = FormatFilter.ANY,
                                     UrlReturnPolicy = UrlReturnPolicy.PREFER
                                 };

            var operationOptions = new OperationOptions { ContentProfile = contentProfile };
            operationOptions.SetProfile(contentProfile);

            return operationOptions;
        }