2 xtawgipl xtawgipl 于 2016.04.10 21:56 提问

微软exchange 2013 怎么赋予查看所有用户(邮箱用户)的邮件的权限 10C

最近在做exchange 2013开发,需要查所有exchange 2013用户有收到邮件时都响应某功能,
现在可以监控某一个用户,当监控所有用户时报 未声明“SubscribeToAllFolders”特性。 错误
以下是代码:
public class NewMailNotification {
public static void main(String[] args) {
try {
Service service = new Service("https://test.cn/EWS/Exchange.asmx", "administrator", "123456");

        String newWatermark = null;

        PullSubscription subscription = new PullSubscription(true, EventType.NEW_MAIL);

        // initial subscribe
        SubscribeResponse subscribeResponse = service.subscribe(subscription);

        while (true) {
            Thread.currentThread().join(1000);

            GetEventsResponse eventsResponse = service.getEvents(subscribeResponse);

            Notification notification = eventsResponse.getNotification();

            for (int i = 0; i < notification.getEvents().size(); i++) {
                newWatermark = notification.getEvents().get(i).getWatermark();
                System.out.println("newWatermark = " + newWatermark);

                if (notification.getEvents().get(i) instanceof NewMailEvent) {
                    NewMailEvent newMailEvent = (NewMailEvent) notification.getEvents().get(i);

                    ItemId itemId = (ItemId) newMailEvent.getId();

                    Message message = service.getMessage(itemId);

                    System.out.println(message.getSubject());
                    System.out.println(message.getReceivedTime());
                    Method[] methods = message.getClass().getMethods();
                    for(Method method : methods){
                        if(method.getName().contains("get") && method.getParameterCount() == 0){
                            Object o = null;
                            try {
                                o = method.invoke(message);
                                if(o == null){
                                    //System.out.println(method.getName() + " --> null");
                                }else{
                                    //System.out.println(method.getName() + " --> " + o.toString());
                                }
                            } catch (IllegalAccessException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            } catch (IllegalArgumentException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            } catch (InvocationTargetException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            }
                        }
                    }
                }
            }

            // resubscribe with new watermark
            subscription.setWatermark(newWatermark);
            subscribeResponse = service.subscribe(subscription);
        }
    } catch (ServiceException e) {
        System.out.println(e.getMessage());
        System.out.println(e.getXmlMessage());

        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

}
请问SubscribeToAllFolders权限怎么赋予

2个回答

devmiao
devmiao   Ds   Rxr 2016.04.10 22:09
xtawgipl
xtawgipl   2016.04.10 22:31

@苏小喵 这个地址打不开哦,是国内站点吗,能否帮忙复制下文字回复一下,非常感谢。

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!