Android 在Exchange服务器上搜索GAL
我需要从exchange server获取GAL的联系人 我有一个在Exchange服务器上搜索GAL的方法 这是有原因的Android 在Exchange服务器上搜索GAL,android,exchange-server,msdn,exchangewebservices,Android,Exchange Server,Msdn,Exchangewebservices,我需要从exchange server获取GAL的联系人 我有一个在Exchange服务器上搜索GAL的方法 这是有原因的 查询字符串:要在GAL中搜索的名称…… 代码如下所示 public int searchGAL( String query, StringBuffer result) throws Exception { // Create the request String uri = mUr
查询字符串:要在GAL中搜索的名称……
代码如下所示
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;
}
public int searchGAL(
字符串查询,
StringBuffer结果)引发异常
{
//创建请求
字符串uri=mUri+“搜索”;
字符串xml=“\n”
+“\n”+
“\t\n”
+“\t\tGAL\n”
+“\t\t”+查询+”\n”
+“\t\t\n”
+“\t\t\t0-99\n”
+“\t\t\n”
+“\t\n”
+ "";
//将其发送到服务器
HttpResponse response=sendPostRequest(createHttpPost(uri,xml,true));
//检查响应代码以查看结果是否为200
//然后才尝试解码内容
int statusCode=response.getStatusLine().getStatusCode();
如果(状态代码==200)
{
//解码XML内容
append(decodeContent(response.getEntity());
}
//解析并返回结果
返回状态码;
}
如何获取服务器中的所有联系人,。。如何查询
当我给空间。。查询将搜索以空格开头的名称。。但当我将空格作为查询字符串传递时,我需要返回所有联系人