Get() public method

public Get ( CmisPath cmisPath ) : ICmisObject
cmisPath CmisPath
return ICmisObject
/*
 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();
            }
        }
        protected override void ProcessRecord()
        {
            var cmisPath = new CmisPath(Path);
            var navigation = new CmisNavigation(CmisSession, WorkingFolder);
            ICmisObject obj = null;
            try
            {
                obj = navigation.Get(cmisPath);
            }
            catch (CmisBaseException e)
            {
                ThrowTerminatingError(new ErrorRecord(e, "GetObjectFailed",
                                                      ErrorCategory.ResourceUnavailable, Path));
                return;
            }

            var nameIsEmpty = String.IsNullOrEmpty(Name);

            if (!(obj is IFolder) ||
                (!cmisPath.HasTrailingSlash() && nameIsEmpty && RecursionDepth < 1))
            {
                WriteObject(obj);
                return;
            }

            WildcardPattern wildcard = new WildcardPattern("*");
            if (!nameIsEmpty)
            {
                wildcard = Exact.IsPresent ? new WildcardPattern(Name)
                                      : new WildcardPattern(Name + "*", WildcardOptions.IgnoreCase);
            }
            int depth = RecursionDepth == 0 ? 1 : RecursionDepth;

            //otherwise we want the descendants of the folder
            var folder = obj as IFolder;
            IList<ITree<IFileableCmisObject>> descendants;
            try
            {
                descendants = folder.GetDescendants(depth);
            }
            catch (CmisBaseException e)
            {
                ThrowTerminatingError(new ErrorRecord(e, "GetDescendatnsFailed",
                                                      ErrorCategory.ResourceUnavailable, Path));
                return;
            }
            WriteTreeList(descendants, wildcard);
        }