Hi folks,
In Console App:
Staic Void(.....){ // rest omitted while (ienum.MoveNext()) { LdapAttribute attribute = (LdapAttribute)ienum.Current; string attributeName = attribute.Name; string attributeVal = attribute.StringValue; if (attributeName == "displayName" || attributeName == "mail") { Console.WriteLine(attributeName + ": " + attributeVal); } } // rest omitted }
Output:
mail: abc@email.com
displayName: abc
mail: xyz@email.com
display: xyz
.
.
.
It seems good. But i want to display output like object array in Web api.
[ {"mail": "abc@email.com","displayName": "abc" }, { "mail": "xyz@email.com","display": "xyz" } . . . ]
In Wep Api:
[HttpGet("UserInfo")] public IActionResult Get() { // rest omitted while (ienum.MoveNext()) { LdapAttribute attribute = (LdapAttribute)ienum.Current; string attributeName = attribute.Name; string attributeVal = attribute.StringValue; if (attributeName == "displayName" || attributeName == "mail") {//Console.WriteLine(attributeName + ": " + attributeVal); ?? } } // rest omitted }
I am waiting for your response.
Thanks in Advance