本文整理汇总了Java中com.microsoft.graph.concurrency.ICallback类的典型用法代码示例。如果您正苦于以下问题:Java ICallback类的具体用法?Java ICallback怎么用?Java ICallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ICallback类属于com.microsoft.graph.concurrency包,在下文中一共展示了ICallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDraftMail
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
/**
* Creates a draft email message using the Microsoft Graph API on Office 365. The mail is sent
* from the address of the signed in user.
*
* @param senderPreferredName The mail senders principal user name (email addr)
* @param emailAddress The recipient email address.
* @param subject The subject to use in the mail message.
* @param body The body of the message.
* @param callback The callback method to invoke on completion of the POST request
*/
public void createDraftMail(
final String senderPreferredName,
final String emailAddress,
final String subject,
final String body,
ICallback<Message> callback
) {
try {
// create the email message
Message message = createMessage(subject, body, emailAddress);
mGraphServiceClient
.getMe()
.getMessages()
.buildRequest()
.post(message, callback);
} catch (Exception ex) {
showException(ex, "exception on send mail","Send mail failed", "The send mail method failed");
}
}
示例2: sendDraftMessage
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
/**
* Sends a draft message to the specified recipients
*
* @param messageId String. The id of the message to send
* @param callback
*/
public void sendDraftMessage(String messageId,
ICallback<Void> callback) {
try {
mGraphServiceClient
.getMe()
.getMessages(messageId)
.getSend()
.buildRequest()
.post(callback);
} catch (Exception ex) {
showException(ex, "exception on send draft message ","Send draft mail failed", "The send draft mail method failed");
}
}
示例3: getSharingLink
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
/**
* Gets the picture sharing link from OneDrive and calls the step 4 helper
*
* @param driveItem
* @param bytes
*/
private void getSharingLink(DriveItem driveItem, final byte[] bytes) {
//3. Get a sharing link to the picture uploaded to OneDrive
mGraphServiceController.getSharingLink(driveItem.id, new ICallback<Permission>() {
@Override
public void success(final Permission permission) {
Log.i("SendMailActivity", "Creating the draft message ");
createDraftMail(permission, bytes);
}
@Override
public void failure(ClientException ex) {
Log.i("SendMailActivity", "Exception on get sharing link " + ex.getLocalizedMessage());
showSendMailErrorUI();
}
});
}
示例4: addPictureToDraftMessage
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
/**
* Adds the picture bytes as attachment to the draft message and calls the step 7 helper
*
* @param aMessage
* @param permission
* @param bytes
*/
private void addPictureToDraftMessage(final Message aMessage, final Permission permission, final byte[] bytes) {
//6. Add the profile picture to the draft mail
mGraphServiceController.addPictureToDraftMessage(aMessage.id, bytes, permission.link.webUrl,
new ICallback<Attachment>() {
@Override
public void success(final Attachment anAttachment) {
Log.i("SendMailActivity", "Sending draft message ");
sendDraftMessage(aMessage);
}
@Override
public void failure(ClientException ex) {
Log.i("SendMailActivity", "Exception on add picture to draft message " + ex.getLocalizedMessage());
showSendMailErrorUI();
}
});
}
示例5: sendDraftMessage
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
/**
* Sends the draft message
*
* @param aMessage
*/
private void sendDraftMessage(final Message aMessage) {
//7. Send the draft message to the recipient
mGraphServiceController.sendDraftMessage(aMessage.id, new ICallback<Void>() {
@Override
public void success(Void aVoid) {
showSendMailSuccessUI();
}
@Override
public void failure(ClientException ex) {
Log.i("SendMailActivity", "Exception on send draft message " + ex.getLocalizedMessage());
showSendMailErrorUI();
}
});
}
示例6: addPictureToDraftMessage
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
/**
* Posts a file attachment in a draft message by message Id
*
* @param messageId String. The id of the draft message to add an attachment to
* @param picture Byte[]. The picture in bytes
* @param sharingLink String. The sharing link to the uploaded picture
* @param callback
*/
public void addPictureToDraftMessage(String messageId,
byte[] picture,
String sharingLink,
ICallback<Attachment> callback) {
try {
byte[] attachementBytes = new byte[picture.length];
if (picture.length > 0) {
attachementBytes = picture;
} else {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){
attachementBytes = getDefaultPicture();
}
else {
attachementBytes = getTestPicture();
}
}
FileAttachment fileAttachment = new FileAttachment();
fileAttachment.oDataType = "#microsoft.graph.fileAttachment";
fileAttachment.contentBytes = attachementBytes;
//fileAttachment.contentType = "image/png";
fileAttachment.name = "me.png";
fileAttachment.size = attachementBytes.length;
fileAttachment.isInline = false;
fileAttachment.id = "blabla";
Log.i("connect sample","attachement id " + fileAttachment.id);
mGraphServiceClient
.getMe()
.getMessages(messageId)
.getAttachments()
.buildRequest()
.post(fileAttachment, callback);
} catch (Exception ex) {
showException(ex, "exception on add picture to draft message","Draft attachment failed", "The post file attachment method failed");
}
}
示例7: getDraftMessage
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
/**
* Gets a draft message by message id
* @param messageId
* @param callback
*/
public void getDraftMessage(String messageId, ICallback<Message> callback) {
try {
mGraphServiceClient.getMe()
.getMessages(messageId)
.buildRequest()
.getMessage(callback);
} catch (Exception ex) {
showException(ex, "exception on get draft message ","Get draft mail failed", "The get draft mail method failed");
}
}
示例8: uploadPictureToOneDrive
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
/**
* Uploads a user picture as byte array to the user's OneDrive root folder
*
* @param picture byte[] picture byte array
* @param callback
*/
public void uploadPictureToOneDrive(byte[] picture, ICallback<DriveItem> callback) {
try {
mGraphServiceClient
.getMe()
.getDrive()
.getRoot()
.getItemWithPath("me.png")
.getContent()
.buildRequest()
.put(picture, callback);
} catch (Exception ex) {
showException(ex, "exception on upload picture to OneDrive ","Upload picture failed", "The upload picture method failed");
}
}
示例9: getSharingLink
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
public void getSharingLink(String id, ICallback<Permission> callback) {
try {
mGraphServiceClient
.getMe()
.getDrive()
.getItems(id)
.getCreateLink("organization", "view")
.buildRequest()
.post(callback);
} catch (Exception ex) {
showException(ex, "exception on get OneDrive sharing link ","Get sharing link failed", "The get sharing link method failed");
}
}
示例10: loginSilentBlocking
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
/**
* Login silently while blocking for the call to return
*
* @return the result of the login attempt
* @throws ClientException The exception if there was an issue during the login attempt
*/
private Void loginSilentBlocking() throws ClientException {
final SimpleWaiter waiter = new SimpleWaiter();
final AtomicReference<Void> returnValue = new AtomicReference<>();
final AtomicReference<ClientException> exceptionValue = new AtomicReference<>();
loginSilent(new ICallback<Void>() {
@Override
public void success(final Void aVoid) {
returnValue.set(aVoid);
waiter.signal();
}
@Override
public void failure(final ClientException ex) {
exceptionValue.set(ex);
waiter.signal();
}
});
waiter.waitForSignal();
//noinspection ThrowableResultOfMethodCallIgnored
if (exceptionValue.get() != null) {
throw exceptionValue.get();
}
return returnValue.get();
}
开发者ID:microsoftgraph,项目名称:msgraph-sdk-android-msa-auth-for-android-adapter,代码行数:35,代码来源:MSAAuthAndroidAdapter.java
示例11: request
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
@Override
public abstract void request(ICallback<Result> callback);
示例12: logout
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
/**
* Logs out the user
*
* @param callback The callback when the logout is complete or an error occurs
*/
void logout(final ICallback<Void> callback);
开发者ID:microsoftgraph,项目名称:msgraph-sdk-android-msa-auth-for-android-adapter,代码行数:7,代码来源:IAuthenticationAdapter.java
示例13: login
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
/**
* Login a user by popping UI
*
* @param activity The current activity
* @param callback The callback when the login is complete or an error occurs
*/
void login(final Activity activity, final ICallback<Void> callback);
开发者ID:microsoftgraph,项目名称:msgraph-sdk-android-msa-auth-for-android-adapter,代码行数:8,代码来源:IAuthenticationAdapter.java
示例14: loginSilent
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
/**
* Login a user with no ui
*
* @param callback The callback when the login is complete or an error occurs
*/
void loginSilent(final ICallback<Void> callback);
开发者ID:microsoftgraph,项目名称:msgraph-sdk-android-msa-auth-for-android-adapter,代码行数:7,代码来源:IAuthenticationAdapter.java
示例15: request
import com.microsoft.graph.concurrency.ICallback; //导入依赖的package包/类
public abstract void request(ICallback<Result> callback);