lundi 8 décembre 2014

An admin user cannot perform context.ExecuteQuery()



In the company we are running multiple scripts against multiple SharePoint Online tenants. They all involve context.ExecuteQuery() at some point. No-one has any issues apart from one user on one specific computer.

If I use my credentials on his computer - it works. So it's not a system issue/dependencies/configuration.

If he uses his credentials on my computer - it works. So it's not a credential issue/permission/access.


When he uses his credentials on his computer - the app crashes/doesn't run, depending on error handling. The issue appears with both Powershell scripts and C# solutions. Error from one of the apps:



Unhandled Exception: System.ArgumentException: '.', hexadecimal value 0x00, is a


n invalid character.


at System.Xml.XmlEncodedRawTextWriter.InvalidXmlChar(Int32 ch, Char* pDst, Bo


olean entitize)


at System.Xml.XmlEncodedRawTextWriter.WriteElementTextBlock(Char* pSrc, Char*


pSrcEnd)


at System.Xml.XmlEncodedRawTextWriter.WriteString(String text)


at System.Xml.XmlWellFormedWriter.WriteString(String text)


at System.Xml.XmlWriter.WriteElementString(String localName, String ns, Strin


g value)


at Microsoft.SharePoint.Client.Idcrl.IdcrlUtility.XmlValueEncode(String value


)


at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.BuildWsSecurityUsingUsernamePa


ssword(String username, String password)


at Microsoft.SharePoint.Client.Idcrl.IdcrlAuth.GetServiceToken(String usernam


e, String password, String serviceTarget, String servicePolicy)


at Microsoft.SharePoint.Client.Idcrl.SharePointOnlineAuthenticationProvider.G


etAuthenticationCookie(Uri url, String username, SecureString password)


at Microsoft.SharePoint.Client.SharePointOnlineCredentials.GetAuthenticationC


ookie(Uri url, Boolean refresh)


at Microsoft.SharePoint.Client.ClientRuntimeContext.SetupRequestCredential(Cl


ientRuntimeContext 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 CreateLists.Program.CreateAnnouncementsList(String site, String credUserna


me, SecureString password, Int32 itemsno)


at CreateLists.Program.Main(String[] args)



I suspected his credentials were somehow cached on his computer so we:

* cleared the cache

* flushed the dns

* cleared all credentials from the credentials manager

* there is no DirSync or Federation on the tenant

* there are no issues on other computers in this network



The issue still persists.








0 commentaires:

Enregistrer un commentaire