• 大小: 867KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-06-17
  • 语言: Java
  • 标签:

资源简介

Important: This preview SDK has been deprecated and is no longer being maintained. We recommend that you use Microsoft Graph and the associated Microsoft Graph SDKs instead. Office 365 SDKs for Android Easily integrate services and data from Office 365 into native Android apps using these Android/Java libraries. :exclamation:NOTE: You are free to use this code and library according to the terms of its included LICENSE and to open issues in this repo for unofficial support. Information about o

资源截图

代码片段和文件信息

package com.microsoft.samples.o365quickstart;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.SettableFuture;
import com.microsoft.aad.adal.AuthenticationCallback;
import com.microsoft.aad.adal.AuthenticationContext;
import com.microsoft.aad.adal.AuthenticationResult;
import com.microsoft.aad.adal.PromptBehavior;
import com.microsoft.services.orc.auth.AuthenticationCredentials;
import com.microsoft.services.orc.core.DependencyResolver;
import com.microsoft.services.orc.http.Credentials;
import com.microsoft.services.orc.http.impl.LoggingInterceptor;
import com.microsoft.services.orc.http.impl.OAuthCredentials;
import com.microsoft.services.orc.http.impl.OkHttpTransport;
import com.microsoft.services.orc.serialization.impl.GsonSerializer;
import com.microsoft.services.outlook.Message;
import com.microsoft.services.outlook.fetchers.OutlookClient;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class MainActivity extends ActionBarActivity {

    Logger logger = LoggerFactory.getLogger(MainActivity.class);

    private static final String TAG = “MainActivity“;
    private static final String outlookbaseUrl = “https://outlook.office.com/api/beta“;

    private AuthenticationContext _authContext;
    private DependencyResolver _resolver;
    private OutlookClient _client;

    private ListView lvMessages;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        lvMessages = (ListView) findViewById(R.id.lvMessages);

        Futures.addCallback(logon() new FutureCallback() {
            @Override
            public void onSuccess(Boolean result) {
                _client = new OutlookClient(outlookbaseUrl _resolver);
                getMessages();
            }

            @Override
            public void onFailure(Throwable t) {
                logger.error(“authentication failed“ t);
            }
        });
    }

    public SettableFuture logon() {

        final SettableFuture result = SettableFuture.create();

        try {
            _authContext = new AuthenticationContext(this “https://login.microsoftonline.com/common/v2.0“ true);
        } catch (Exception e) {
            Log.e(TAG “Failed to initialize Authentication Context with error: “ + e.getMessage());
            _authContext = null;
            result.setException(e);
        }

        if (_authContext != null) {
            _authContext.acquireToken(
              

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\
     文件         315  2017-12-28 21:30  Office-365-SDK-for-Android-master\.gitignore
     文件        3478  2017-12-28 21:30  Office-365-SDK-for-Android-master\CHANGES.md
     文件         595  2017-12-28 21:30  Office-365-SDK-for-Android-master\LICENSE
     文件       11890  2017-12-28 21:30  Office-365-SDK-for-Android-master\NOTICES.md
     文件        3735  2017-12-28 21:30  Office-365-SDK-for-Android-master\README.md
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\
     文件         694  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\build.gradle
     文件         668  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\proguard-rules.pro
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\
     文件         770  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\AndroidManifest.xml
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\java\
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\java\com\
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\java\com\microsoft\
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\java\com\microsoft\samples\
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\java\com\microsoft\samples\o365quickstart\
     文件        7220  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\java\com\microsoft\samples\o365quickstart\MainActivity.java
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\res\
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\res\layout\
     文件         626  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\res\layout\activity_main.xml
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\res\menu\
     文件         361  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\res\menu\menu_main.xml
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\res\mipmap-hdpi\
     文件        3418  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\res\mipmap-hdpi\ic_launcher.png
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\res\mipmap-mdpi\
     文件        2206  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\res\mipmap-mdpi\ic_launcher.png
     目录           0  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\res\mipmap-xhdpi\
     文件        4842  2017-12-28 21:30  Office-365-SDK-for-Android-master\samples\O365QuickStart\app\src\main\res\mipmap-xhdpi\ic_launcher.png
............此处省略525个文件信息

评论

共有 条评论