/// <summary>
        /// Obtains information about a cloud file or folder by ID or path; returns NULL for not found
        /// </summary>
        /// <param name="connector">connection to use</param>
        /// <param name="objectType">specifies file or folder</param>
        /// <param name="specType">specifies format of supplied specification (id or path)</param>
        /// <param name="request">file or folder specification</param>
        /// <returns>null if file not found (404)</returns>
        public static async Task <CloudFile> GetCloudObjectInfo(CloudElementsConnector connector,
                                                                CloudElementsConnector.DirectoryEntryType objectType,
                                                                CloudElementsConnector.FileSpecificationType specType,
                                                                string request)
        {
            CloudFile CloudObjectInfo;

            try
            {
                CloudObjectInfo = await connector.GetDocEntryMetaData(objectType, specType, request, true);
            }
            catch (System.Net.Http.HttpRequestException hx)
            {
                if (hx.Message.IndexOf("404") > 0)
                {
                    string traceInfo = string.Format("ce(GetCloudObjectInfo,{1},{2}) {0}", hx.Message, specType, request);
                    connector.OnDiagTrace(traceInfo);
                    CloudObjectInfo = null;
                }
                else
                {
                    throw hx;
                }
            }
            return(CloudObjectInfo);
        }
Beispiel #2
0
        /// <summary>
        /// Gets CloudFile Meta Data, updates tags and stores if necessary
        /// </summary>
        /// <param name="connector">The API connector instance</param>
        /// <param name="fileSpecType">Indicates if ID or Path</param>
        /// <param name="identifier">ID or Path</param>
        /// <param name="tagValues">list of tags to be stored</param>
        /// <returns>Update CloudFile</returns>
        public static async Task <CloudFile> SetTag(CloudElementsConnector connector, CloudElementsConnector.FileSpecificationType fileSpecType, string identifier, List <string> tagValues)
        {
            CloudFile fileData;

            fileData = await connector.GetFileMetaData(fileSpecType, identifier);

            fileData = await SetTag(connector, fileData, tagValues);

            return(fileData);
        }
 /// <summary>
 /// Obtains information about a cloud file by ID or path; returns NULL for not found
 /// </summary>
 /// <param name="connector">connection to use</param>
 /// <param name="specType">specifies format of supplied file specification</param>
 /// <param name="requestFilePath">file specification</param>
 /// <returns>null if file not found (404)</returns>
 public static async Task <CloudFile> GetCloudFileInfo(CloudElementsConnector connector,
                                                       CloudElementsConnector.FileSpecificationType specType,
                                                       string requestFilePath)
 {
     return(await GetCloudObjectInfo(connector, CloudElementsConnector.DirectoryEntryType.File, specType, requestFilePath));
 }
Beispiel #4
0
        /// <summary>
        /// Gets CloudFile Meta Data, updates tags and stores if necessary
        /// </summary>
        /// <param name="connector">The API connector instance</param>
        /// <param name="fileSpecType">Indicates if ID or Path</param>
        /// <param name="identifier">ID or Path</param>
        /// <param name="tagValue">tag to be stored</param>
        /// <returns>Update CloudFile</returns>
        public static async Task <CloudFile> SetTag(CloudElementsConnector connector, CloudElementsConnector.FileSpecificationType fileSpecType, string identifier, string tagValue)
        {
            List <string> tagValues = new List <string>();

            tagValues.Add(tagValue);
            CloudFile fileData;

            fileData = await SetTag(connector, fileSpecType, identifier, tagValues);

            return(fileData);
        }