/// <summary> /// Upload the specified data content to a remote report (parent/name). /// </summary> /// <param name="dataType">Must be "Report" to upload a report content</param> /// <param name="sourceFile"></param> /// <param name="parent"></param> /// <param name="data"></param> /// <returns></returns> public async System.Threading.Tasks.Task CreateCatalogItem(string dataType, FileInfo sourceFile, DirectoryInfo relativeTo, string remoteParent, byte[] data) { TrustedUserHeader header = new TrustedUserHeader(); Property prop1 = new Property() { Name = "MimeType", Value = MimeTypes.MimeTypeMap.GetMimeType(sourceFile.Extension) }; string filenameWithoutExtension = sourceFile.Name.Substring(0, Convert.ToInt32(sourceFile.Name.Length - sourceFile.Extension.Length)); string parent = await this.CreateSubFolders(sourceFile.FullName, relativeTo.FullName, remoteParent); await System.Threading.Tasks.Task.Factory.FromAsync( _service.BeginCreateCatalogItem(header, dataType, filenameWithoutExtension, parent, true, data, String.IsNullOrEmpty(prop1.Value) ? null : new Property[] { prop1 }, null, null) , (ar) => { CatalogItem catalogItem; Warning[] warning; _service.EndCreateCatalogItem(ar, out catalogItem, out warning); return(data); }); }