/// <summary> /// Creates metadata for a SCO, or updates existing metadata describing a SCO. /// Call SCO-update to create metadata only for SCOs that represent content, including /// meetings. You also need to upload content files with either SCO-upload or Connect Enterprise Manager. /// You must provide a folder-id or a SCO id, but not both. If you pass a folder-id, SCO-update /// creates a new SCO and returns a SCO id. If the SCO already exists and you pass a /// SCO-id, SCO-update updates the metadata describing the SCO. /// After you create a new SCO with SCO-update, call permissions-update to specify which /// users and groups can access it. /// </summary> /// <typeparam name="T"> /// Base update item. /// </typeparam> /// <param name="meetingUpdateItem"> /// The meeting item. /// </param> /// <param name="isUpdate"> /// Is Update. /// </param> /// <returns> /// Save Meeting Result. /// </returns> private ScoInfoResult ScoUpdate <T>(T meetingUpdateItem, bool isUpdate) where T : ScoUpdateItemBase { if (meetingUpdateItem == null) { return(null); } //if (string.IsNullOrEmpty(scoUpdateItem.FolderId)) //{ // return new ScoInfoResult(CreateStatusInfo(StatusCodes.invalid, StatusSubCodes.format, new ArgumentNullException("scoUpdateItem", "FolderId must be set to create new item"))); //} var commandParams = QueryStringBuilder.EntityToQueryString(meetingUpdateItem, isUpdate); StatusInfo status; var doc = this.requestProcessor.Process(Commands.Sco.Update, commandParams, out status); if (!ResponseIsOk(doc, status)) { return(new ScoInfoResult(status)); } if (isUpdate) { return(this.GetScoInfo(meetingUpdateItem.ScoId)); } // notice: no '/sco' will be returned during update var detailNode = doc.SelectSingleNode(ScoHome); if (detailNode == null || detailNode.Attributes == null) { return(new ScoInfoResult(status)); } ScoInfo meetingDetail = null; try { meetingDetail = ScoInfoParser.Parse(detailNode); } catch (Exception ex) { TraceTool.TraceException(ex); status.Code = StatusCodes.invalid; status.SubCode = StatusSubCodes.format; status.UnderlyingExceptionInfo = ex; } return(new ScoInfoResult(status, meetingDetail)); }
/// <summary> /// The get SCO info. /// </summary> /// <param name="scoUrl"> /// The SCO url. /// </param> /// <returns> /// The <see cref="ScoInfoResult"/>. /// </returns> public ScoInfoResult GetScoByUrl(string scoUrl) { if (string.IsNullOrWhiteSpace(scoUrl)) { throw new ArgumentException("Non-empty value expected", nameof(scoUrl)); } // act: "sco-by-url" StatusInfo status; var pathId = scoUrl.Split(new[] { '\\', '/' }, StringSplitOptions.RemoveEmptyEntries).LastOrDefault(); var urlPath = string.Format("/{0}/", pathId); var doc = this.requestProcessor.Process(Commands.Sco.ByUrl, string.Format(CommandParams.UrlPath, urlPath), out status); return(ResponseIsOk(doc, status) ? new ScoInfoResult(status, ScoInfoParser.Parse(doc.SelectSingleNode(ScoHome))) : new ScoInfoResult(status)); }
/// <summary> /// The get SCO info. /// </summary> /// <param name="scoId"> /// The SCO id. /// </param> /// <returns> /// The <see cref="ScoInfoResult"/>. /// </returns> public ScoInfoResult GetScoInfo(string scoId) { if (string.IsNullOrWhiteSpace(scoId)) { throw new ArgumentException("Non-empty value expected", nameof(scoId)); } // act: "sco-info" StatusInfo status; var doc = this.requestProcessor.Process(Commands.Sco.Info, string.Format(CommandParams.ScoId, scoId), out status); if (ResponseIsOk(doc, status)) { var mainSco = ScoInfoParser.Parse(doc.SelectSingleNode(ScoHome)); //todo: move to parser mainSco.SourceSco = ScoInfoParser.Parse(doc.SelectSingleNode("//source-sco/source-sco")); return(new ScoInfoResult(status, mainSco)); } return(new ScoInfoResult(status)); }