OfficeDev / Project-Samples

This Project Online add-in demonstrates how to create a project using DotNet with CSOM
63 stars 72 forks source link

UserPrincipal.Current.DisplayName causes invalid cast exception on login #7

Open JBoman32768 opened 7 years ago

JBoman32768 commented 7 years ago

When logging into Project Online from a WIndows 10 AzureAD joined machine UserPrincipal.Current.DisplayName produces exception

Unable to cast object of type 'System.DirectoryServices.AccountManagement.GroupPrincipal' to type 'System.DirectoryServices.AccountManagement.UserPrincipal'.

Looks like its trying to get the displayname for the user currently logged into the local computer - which in most cases is irrelevant to the login to the remote system.

JBoman32768 commented 7 years ago

Added Pull Request for this.