Example #1
0
        /// <summary>
        /// Return an item that represents a special named folder from the service.
        /// </summary>
        /// <param name="folder"></param>
        /// <returns></returns>
        public async Task <OneDriveItem> GetNamedFolderProperties(NamedFolder folder)
        {
            string pathToNamedFolder = string.Concat("/me" + FolderPathAttribute.FolderPathForValue(folder));

            return(await GetObjectFromRequest <OneDriveItem>(pathToNamedFolder,
                                                             (json) => OneDriveItem.CreateFromRawJson(json, this)));
        }
        public static string FolderPathForValue <T>(T enumValue)
        {
            Type t          = typeof(T);
            var  memberInfo = t.GetMember(enumValue.ToString()).FirstOrDefault();

            if (null == memberInfo)
            {
                return(string.Empty);
            }
            FolderPathAttribute attrib = (FolderPathAttribute)memberInfo.GetCustomAttributes(typeof(FolderPathAttribute), true).FirstOrDefault();

            if (null != attrib)
            {
                return(attrib.Path);
            }
            return(string.Empty);
        }