internal static OneDriveUser UserForRequest(HttpRequestBase request)
        {
            try
            {
                string userGuid = request.Cookies["oneDriveUser"].Value;
                return(OneDriveUserManager.LookupUserById(userGuid));
            }
            catch { }

            return(null);
        }
        public OneDriveUser(OAuthToken token, OAuthHelper helper, string resource = null)
        {
            this.UserId          = Guid.NewGuid().ToString();
            this.AuthHelper      = helper;
            this.ClientType      = helper.IsConsumerService ? Microsoft.OneDrive.Sdk.ClientType.Consumer : Microsoft.OneDrive.Sdk.ClientType.Business;
            this.FileNameAndETag = new Dictionary <string, string>();
            if (!string.IsNullOrEmpty(token.RefreshToken))
            {
                this.RefreshToken = token.RefreshToken;
            }

            if (!string.IsNullOrEmpty(resource))
            {
                TokenCache[resource] = token;
            }


            OneDriveUserManager.RegisterUser(this.UserId, this);
        }