コード例 #1
0
        public async Task<SPAccessTokens> GetAccessTokens()
        {
            // GET FeAuth and rtFA
            CookieContainer feAuthCookie = await GetCookieContainer();

            if (feAuthCookie != null)
            {
                SoapRequest soap = new SoapRequest(SoapEndpoint, SOAPACTION);
                soap.cookie = feAuthCookie;

                string digestToken = soap.CallWebService();
                XmlDocument xmlDigest = new XmlDocument();
                xmlDigest.LoadXml(digestToken); // suppose that myXmlString contains "<Names>...</Names>"
                digestToken = xmlDigest.GetElementsByTagName("DigestValue")[0].InnerText;


                SPAccessTokens token = new SPAccessTokens();
                token.cookies = feAuthCookie.GetCookies(spSiteUrl);
                token.requestDigest = digestToken;

                return token;
            }

            return null;
        }
コード例 #2
0
        public SPAccessTokens RefreshDigestToken(string _soapEndpoint, CookieContainer _feAuthCookie)
        {
            if (_feAuthCookie != null)
            {
                SoapRequest soap = new SoapRequest(SoapEndpoint, SOAPACTION);
                soap.cookie = _feAuthCookie;

                string digestToken = soap.CallWebService();
                XmlDocument xmlDigest = new XmlDocument();
                xmlDigest.LoadXml(digestToken); // suppose that myXmlString contains "<Names>...</Names>"
                digestToken = xmlDigest.GetElementsByTagName("DigestValue")[0].InnerText;


                SPAccessTokens token = new SPAccessTokens();
                token.cookies = _feAuthCookie.GetCookies(spSiteUrl);
                token.requestDigest = digestToken;

                return token;
            }

            return null;
        }