Microsoft.Protocols.TestSuites.MS_OXNSPI.NspiMapiHttpAdapter.ResolveNames C# (CSharp) Method

ResolveNames() public method

The NspiResolveNamesW method takes a set of string values in the Unicode character set and performs ANR on those strings.
public ResolveNames ( uint reserved, STAT stat, PropertyTagArray_r propTags, WStringsArray_r wstr, PropertyTagArray_r &mids, PropertyRowSet_r &rows ) : ErrorCodeValue
reserved uint A DWORD value that is reserved for future use.
stat STAT A STAT block that describes a logical position in a specific address book container.
propTags PropertyTagArray_r The value NULL or a reference to a PropertyTagArray_r containing a list of the proptags of the columns /// that the client requests to be returned for each row returned.
wstr WStringsArray_r A WStringsArray_r value. It specifies the values on which the client is requesting the server to perform ANR.
mids PropertyTagArray_r A PropertyTagArray_r value. On return, it contains a list of Minimal Entry IDs that match the array of strings.
rows PropertyRowSet_r A reference to a PropertyRowSet_r structure. It contains the address book container rows that the server returns in response to the request.
return ErrorCodeValue
        public ErrorCodeValue ResolveNames(uint reserved, STAT stat, PropertyTagArray_r? propTags, WStringsArray_r? wstr, out PropertyTagArray_r? mids, out PropertyRowSet_r? rows)
        {
            ErrorCodeValue result;
            byte[] auxIn = new byte[] { };
            ResolveNamesRequestBody resolveNamesRequestBody = new ResolveNamesRequestBody()
            {
                Reserved = reserved,
                HasState = true,
                State = stat,
                AuxiliaryBuffer = auxIn,
                AuxiliaryBufferSize = (uint)auxIn.Length
            };

            if (propTags != null)
            {
                LargePropTagArray propetyTags = new LargePropTagArray();
                propetyTags.PropertyTagCount = propTags.Value.CValues;
                propetyTags.PropertyTags = new PropertyTag[propetyTags.PropertyTagCount];
                for (int i = 0; i < propTags.Value.CValues; i++)
                {
                    propetyTags.PropertyTags[i].PropertyId = (ushort)((propTags.Value.AulPropTag[i] & 0xFFFF0000) >> 16);
                    propetyTags.PropertyTags[i].PropertyType = (ushort)(propTags.Value.AulPropTag[i] & 0x0000FFFF);
                }

                resolveNamesRequestBody.HasPropertyTags = true;
                resolveNamesRequestBody.PropertyTags = propetyTags;
            }
            else
            {
                resolveNamesRequestBody.HasPropertyTags = false;
                resolveNamesRequestBody.PropertyTags = new LargePropTagArray();
            }

            if (wstr != null)
            {
                resolveNamesRequestBody.HasNames = true;
                resolveNamesRequestBody.Names = wstr.Value;
            }
            else
            {
                resolveNamesRequestBody.HasNames = false;
            }

            ChunkedResponse chunkedResponse = this.SendAddressBookRequest(resolveNamesRequestBody, RequestType.ResolveNames);
            ResolveNamesResponseBody resolveNamesResponseBody = ResolveNamesResponseBody.Parse(chunkedResponse.ResponseBodyRawData);
            result = (ErrorCodeValue)resolveNamesResponseBody.ErrorCode;
            if (resolveNamesResponseBody.RowCount != null)
            {
                PropertyRowSet_r newRows = AdapterHelper.ParsePropertyRowSet_r(resolveNamesResponseBody.PropertyTags.Value, resolveNamesResponseBody.RowCount.Value, resolveNamesResponseBody.RowData);
                rows = newRows;
            }
            else
            {
                rows = null;
            }

            if (resolveNamesResponseBody.HasMinimalIds)
            {
                PropertyTagArray_r propertyTagArray = new PropertyTagArray_r();
                propertyTagArray.CValues = resolveNamesResponseBody.MinimalIdCount.Value;
                propertyTagArray.AulPropTag = resolveNamesResponseBody.MinimalIds;
                mids = propertyTagArray;
            }
            else
            {
                mids = null;
            }

            return result;
        }