none
CSOM and O365 Auth RRS feed

  • Question

  • Hello,

    Ultimately I am wanting to use the Project SDK to authenticate to a Project Online site to pull projects, but I'm having trouble authenticating through O365.

    I followed this blog:

    http://blogs.msdn.com/b/kaevans/archive/2014/02/23/call-o365-using-csom-with-a-console-application.aspx

    to authenticate to my SharePoint online site. I'm met with the following exception with my console app:

    Microsoft.SharePoint.Client.IdcrlException was unhandled

      HResult=-2147186646

      Message=The Application ID (AppID) for which the service ticket is requested does not exist on the system.

      Source=Microsoft.SharePoint.Client.Runtime

      ErrorCode=-2147186646

      StackTrace:

           at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.ParseFPDomainName(XDocument xdoc)

           at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.RequestFederationProviderInfo(String domainname)

           at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetFederationProviderInfo(String domainname)

           at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.InitFederationProviderInfoForUser(String username)

           at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetServiceToken(String username, String password, String serviceTarget, String servicePolicy)

           at Microsoft.SharePoint.Client.Idcrl.SharePointOnlineAuthenticationProvider.GetAuthenticationCookie(Uri url, String username, SecureString password, Boolean alwaysThrowOnFailure)

           at Microsoft.SharePoint.Client.SharePointOnlineCredentials.GetAuthenticationCookie(Uri url, Boolean refresh, Boolean alwaysThrowOnFailure)

           at Microsoft.SharePoint.Client.ClientRuntimeContext.SetupRequestCredential(ClientRuntimeContext context, HttpWebRequest request)

           at Microsoft.SharePoint.Client.SPWebRequestExecutor.GetRequestStream()

           at Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate()

           at Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest()

           at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()

           at ReadProjectList.Program.Main(String[] args) in d:\Projects\Samples\CSOM\ReadProjectList\Program.cs:line 39

           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

           at System.Threading.ThreadHelper.ThreadStart()

      InnerException:

    I followed the MSDN guidelines for creating an app permissions in SharePoint have the following tags in the app.config file:

    <appSettings>
        <add key="ClientId" value="some_guid"/>
        <add key="ClientSecret" value="this is a secret"/>
        <add key="Realm" value="some_guid"/>
      </appSettings>

    Here is the following code that gives me the error:

    private const string pwaPath = "https://smartdeploy.sharepoint.com/sites/pwa"; 
    var pass = new SecureString();
    "somepassword".ToList().ForEach(c => pass.AppendChar(c));
    ClientContext test = new ClientContext(pwaPath);
    test.Credentials = new SharePointOnlineCredentials("allen.anderson@smartdeploy.onmicrosoft.com", pass);
    test.Load(test.Web);
    test.ExecuteQuery();

    I know I'm missing something here... ??

    Thanks!


    Allen Anderson -- Cireson -- www.cireson.com


    Friday, August 22, 2014 7:34 PM