Quantcast
Channel: Developing Apps for SharePoint 2013 forum
Viewing all articles
Browse latest Browse all 8089

SPClaimProviderManager.DecodeClaim() throws exception - why?

$
0
0

I'm trying to get a regular domain user name from CBA text that came from browser:

Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager cpm = Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.Local;
u1 = cpm.DecodeClaim(HttpContext.Current.User.Identity.Name).Value;

At the moment of last line execution HttpContext.Current.User.Identity.Name contains "0#.w|msk\\spadmin". Given that value as the input parameter, the function throws the following exception:

System.ArgumentException: Exception of type 'System.ArgumentException' was thrown.
Parameter name: value
   at Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaim(String value)

All what I wanted is to have msk\spadmin returned without low-level manual string parsing. Is there any way to get what I want basing on Sharepoint API?


Viewing all articles
Browse latest Browse all 8089

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>