/* TODO: enable support for propertie [Parameter(Position = 3, Mandatory = false)] public Hashtable Properties { get; set; } */ protected override void EndProcessing() { var path = new CmisPath(Path); if (LocalFile != null && path.HasTrailingSlash()) { path = path.Combine(System.IO.Path.GetFileName(LocalFile)); } var nav = new CmisNavigation(CmisSession, WorkingFolder); // var props = Utilities.HashtableToDict(Properties); var stream = GetContentStream(); try { // WriteObject(nav.CreateDocument(path, stream, props)); WriteObject(nav.CreateDocument(path, stream, null)); } catch (CmisBaseException e) { ThrowTerminatingError(new ErrorRecord(e, "CreateDocumentFailed", ErrorCategory.WriteError, path)); } finally { if (stream != null) { 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); }