Cmis.Utility.CmisNavigation.Get C# (CSharp) Метод

Get() публичный Метод

public Get ( CmisPath cmisPath ) : ICmisObject
cmisPath CmisPath
Результат ICmisObject
        public ICmisObject Get(CmisPath cmisPath)
        {
            ICmisObject obj;
            if (!TryGet(cmisPath, out obj))
            {
                // DotCMIS is not very generous when it comes to generating error messages
                // so we create a better one
                var msg = String.Format("The path '{0}' doesn't identify a CMIS object.",
                                        cmisPath.ToString());
                throw new CmisObjectNotFoundException(msg);
            }
            return obj;
        }

Usage Example

/*
 TODO: enable support for properties
        [Parameter(Position = 4, Mandatory = false)]
        public Hashtable Properties { get; set; }
*/

        protected override void EndProcessing()
        {
            var navigation = new CmisNavigation(CmisSession, WorkingFolder);
            ICmisObject obj = (Object != null) ? Object : navigation.Get(Path);

/*
            if (Properties != null || !String.IsNullOrEmpty(Name))
            {
                var props = Utilities.HashtableToDict(Properties);
                if (!String.IsNullOrEmpty(Name))
                {
                    props[PropertyIds.Name] = Name;
                }
                obj = obj.UpdateProperties(props);
            }
 */
            if (!String.IsNullOrEmpty(Name))
            {
                var props = new Dictionary<string, object>() { { PropertyIds.Name, Name } };
                obj = obj.UpdateProperties(props);
            }

            // check if we should update content
            if (LocalFile == null && !HasContent())
            {
                WriteObject(obj);
                return; 
            }

            // otherwise the object must be a document
            var doc = obj as IDocument;
            if (doc == null)
            {
                var ex = new CmisObjectNotFoundException("The provided object is not a Document");
                ThrowTerminatingError(new ErrorRecord(ex, "UpdateObjNotDocument",
                                                      ErrorCategory.InvalidArgument, Object));
            }

            var stream = GetContentStream();
            stream.FileName = obj.Name; // important, as may not set
            try
            {
                var result = doc.SetContentStream(stream, true);
                WriteObject(result == null ? doc : result);
            }
            finally
            {
                stream.Stream.Close();
            }
        }
All Usage Examples Of Cmis.Utility.CmisNavigation::Get