1

I have the following code in use within 2 web application projects, both of which are part of the same solution. The two projects interact with each other, one contains a web service and code that builds a Pivot Viewer collection (CXML + images), the other is a simple web application that hosts the container page that displays the Pivot Viewer control.

The two projects need to interact with a SharePoint site that contains a couple of lists. The lists contain data used to build the CXML collection and to log access to data items exposed by the collection. The following code exists in both projects.

using SP = Microsoft.SharePoint.Client;
///.......

string siteURL = ConfigurationManager.AppSettings["SharePointURL"];
ClientContext clientContext = new ClientContext(siteURL);
string listName = ConfigurationManager.AppSettings["ListName"];
SP.List downloadRequestList = clientContext.Web.Lists.GetByTitle(listName);


string username = ConfigurationManager.AppSettings.Get("SharePointCredentialUsername");
string userkey = ConfigurationManager.AppSettings.Get("SharePointCredentialPassword");
SecureString securekey = new SecureString();
for (int i = 0; i < userkey.Length; i++)
    securekey.AppendChar(userkey[i]);

SharePointOnlineCredentials credentials = new SharePointOnlineCredentials(username, securekey);//error occurs here
clientContext.Credentials = credentials;

The code executes without problems in one project (web service), the other project (web application) throws a COMException on the line where SharePointOnlineCredentials are instantiated (2nd from bottom in snippet above).

Exception details:

Message:{"Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"}

Source "Microsoft.SharePoint.Client.Runtime"

HResult/ErrorCode -2147418113

StackTrace at Microsoft.SharePoint.Client.Idcrl.ManagedIdcrl.EnsureInited() at Microsoft.SharePoint.Client.Idcrl.ManagedIdcrl.LogonIdentity(String username, SecureString password) at Microsoft.SharePoint.Client.SharePointOnlineCredentials..ctor(String username, SecureString password) at PivotServer.Download.SaveDownloadListItem() in download.aspx.cs:line 104

I have matched the web.config file for both projects, they contain the same entries. A related thread suggested setting the Application Pool Identity to "Local System", that did not make a difference.

Thanks in advance, any advice, suggestions, code samples dearly appreciated.

Mat
  • 202,337
  • 40
  • 393
  • 406
kannankeril
  • 187
  • 1
  • 6

6 Answers6

1

I had this error message and it turned out that ScanSafe was blocking bin files, so we couldn't access http://clientconfig.microsoftonline-p.net/ppcrlconfig600.bin, which is needed to login.

Once we updated the settings to allow the download of binary files it resolved the error.

Catherine
  • 148
  • 9
0

Today I came across the same issue, it occurred on an azure web role. What I did after deploying the web role to azures:

  1. Connect to web role server via rdp.
  2. Install SharePoint Client Components SDK
  3. Go IIS Manager
  4. Change Application Pool Identity to local Administrator (the account I created to log on the web role server)
  • this is not really required, and probably not a good idea since the web role instance(s) could be restarted at any moment, and your manual steps won't be done through the package. You simply need to change your azure ServiceConfiguration.cscfg files to set the web role to execute with elevated permissions. Also, the SharePoint DLLs (Microsoft.SharePoint.Client and .Runtime.dll) should be added as references to your role project(s) with CopyLocal = true. That way you don't need to install the client SDK on the servers. – Thiago Silva Jun 18 '14 at 14:22
0

I had the same exception. To resolve it :

Connect to http://login.microsoftonline.com in IE with the account that you will use in your app (or app pool) and install the certificate from the page.

It solved my problem.

Hope can help.

Iveusse
  • 1
  • 2
0

I had the same problem, and tried all of the above things, without luck. It turned out to be my antivirus Bitdefender 2013. When I disabled the scanner it worked.

BoKDamgaard
  • 378
  • 1
  • 19
0

I had the same error and none of the previous answers resolved this. I ended up going to the site application in IIS Manager and setting the physical path credentials under Advanced Settings.

Madison
  • 411
  • 5
  • 14
0

It got resolved after I set Internet Security Settings. Go to Internet Options-> Security -> Internet -> Custom Level -> Enable .Net Framework and other few activex controls.

user1805377
  • 73
  • 1
  • 9