How to read msExchMailboxSecurityDescriptor attribute in C#

后端 未结 1 825
不知归路
不知归路 2021-01-20 01:46

I am trying to read all the user attributes in AD.

How to read msExchMailboxSecurityDescriptor attribute in C# ?

I used the following code but

相关标签:
1条回答
  • 2021-01-20 02:26

    Ok. I was able to figure it out. The code is given below for anyone interested. I wish Microsoft had put out some code samples so that people do not have to break their heads.

         SecurityDescriptor sd = (SecurityDescriptor) p_InputValue;
               AccessControlList acl = (AccessControlList)sd.DiscretionaryAcl;
                  String m_Trustee = "";
                  String m_AccessMask = "";
                  String m_AceType = "";
                  String m_ReturnValue="";
    
                      foreach (AccessControlEntry ace in (IEnumerable)acl)
                        {
                          m_Trustee = m_Trustee + "," + ace.Trustee;
                         m_AccessMask = m_AccessMask + "," + ace.AccessMask.ToString();
                          m_AceType = m_AceType + "," +ace.AceType.ToString();
    
                         }
             m_ReturnValue="Trustee: " + m_Trustee + " " + "AccessMask: " + m_AccessMask + "AceType: " + m_AceType;
             return m_ReturnValue
    
    0 讨论(0)
提交回复
热议问题