Microsoft.Protocols.TestSuites.MS_OXCFOLD.S05_InsufficientRightsOnFolder.GetEntryId C# (CSharp) Method

GetEntryId() private method

Get EntryId by user name.
private GetEntryId ( string userEssdn ) : byte[]
userEssdn string The user ESSDN.
return byte[]
        private byte[] GetEntryId(string userEssdn)
        {
            // Generate the Entry ID.
            if (string.IsNullOrEmpty(userEssdn))
            {
                return new byte[0];
            }

            string distinguishedName = userEssdn + Constants.StringNullTerminated;
            int pidEntryIdLength = 28 + distinguishedName.Length;
            byte[] pidEntryId = new byte[pidEntryIdLength];

            // Create the PidTagEntryId as PermanentEntryID described in section 2.3.8.3, [MS-OXNSPI]
            int i = 0;
            pidEntryId[i] = 0x00;
            i++;
            pidEntryId[i] = 0x00;
            i++;
            pidEntryId[i] = 0x00;
            i++;
            pidEntryId[i] = 0x00;
            i++;

            byte[] providerUID = new byte[16] { 0xDC, 0xA7, 0x40, 0xC8, 0xC0, 0x42, 0x10, 0x1A, 0xB4, 0xB9, 0x08, 0x00, 0x2B, 0x2F, 0xE1, 0x82 };
            Array.Copy(providerUID, 0, pidEntryId, i, 16);
            i += 16;

            byte[] r4 = BitConverter.GetBytes(0x00000001);
            Array.Copy(r4, 0, pidEntryId, i, 4);
            i += 4;

            byte[] displayTypeString = new byte[4] { 0, 0, 0, 0 };
            Array.Copy(displayTypeString, 0, pidEntryId, i, 4);
            i += 4;

            byte[] distinguishedNameBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(distinguishedName);
            Array.Copy(distinguishedNameBytes, 0, pidEntryId, i, distinguishedName.Length);

            return pidEntryId;
        }