在Exchange服务器上搜索GAL

时间:2012-03-13 05:47:29

标签: android exchange-server msdn exchangewebservices

我需要从交换服务器获取GAL的联系人..

我有一个在Exchange服务器上搜索GAL的方法

query string : The name to search the GAL for....

代码如下....

public int searchGAL(
            String query, 
            StringBuffer result) throws Exception 
    {
        // Create the request

        String uri = mUri + "Search";


String  xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
                + "<Search xmlns=\"Search:\">\n" + 
                "\t<Store>\n"
                + "\t\t<Name>GAL</Name>\n" 
                + "\t\t<Query>" + query + "</Query>\n" 
                + "\t\t<Options>\n"
                + "\t\t\t<Range>0-99</Range>\n"
                + "\t\t</Options>\n"
                + "\t</Store>\n"
                + "</Search>";

               // Send it to the server
        HttpResponse response = sendPostRequest(createHttpPost(uri,xml,true));  

        // Check the response code to see if the result was 200
        // Only then try to decode the content

        int statusCode = response.getStatusLine().getStatusCode();

        if(statusCode == 200)
        {
            // Decode the XML content
            result.append(decodeContent(response.getEntity())); 
        }

// parse and return the results
        return statusCode;
    }   

如何获取服务器中的所有联系人,..如何查询?

当我给出空格时...查询将搜索以空格开头的名称..但是当我将空格作为查询字符串传递时,我需要返回所有联系人。

http://msdn.microsoft.com/en-us/library/ff631384(v=exchg.80).aspx

0 个答案:

没有答案