本文整理汇总了Java中com.microsoft.outlookservices.Message.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getId方法的具体用法?Java Message.getId怎么用?Java Message.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.microsoft.outlookservices.Message
的用法示例。
在下文中一共展示了Message.getId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: forwardDraftMail
import com.microsoft.outlookservices.Message; //导入方法依赖的package包/类
/**
* Forwards a message out of the user's Inbox folder by id
*
* @param emailId The id of the mail to be forwarded
* @param recipientEmailAddress The email address string of the recipient
* @return String. The id of the sent email
*/
public String forwardDraftMail(String emailId, String recipientEmailAddress) throws ExecutionException, InterruptedException {
Message forwardMessage = mOutlookClient
.getMe()
.getMessages()
.getById(emailId)
.getOperations()
.createForward()
.get();
//Get the new draft email to forward to the specified email recipient
Message draftMessage = getDraftMessageMap()
.get(forwardMessage.getConversationId());
//Set the recipient list for the draft message
draftMessage.setToRecipients(createEmailRecipientList(recipientEmailAddress));
mOutlookClient
.getMe()
.getOperations()
.sendMail(draftMessage, false)
.get();
return draftMessage.getId();
}
示例2: addDraftMail
import com.microsoft.outlookservices.Message; //导入方法依赖的package包/类
/**
* Gets a message out of the user's draft folder by id and adds a text file attachment
*
* @param emailAddress The email address of the mail recipient
* @param subject The subject of the email
* @param body The body of the email
* @return String. The id of the email added to the draft folder
*/
public String addDraftMail(
final String emailAddress,
final String subject,
final String body) throws ExecutionException, InterruptedException {
// Prepare the message.
List<Recipient> recipientList = new ArrayList<>();
Recipient recipient = new Recipient();
EmailAddress email = new EmailAddress();
email.setAddress(emailAddress);
recipient.setEmailAddress(email);
recipientList.add(recipient);
Message messageToSend = new Message();
messageToSend.setToRecipients(recipientList);
ItemBody bodyItem = new ItemBody();
bodyItem.setContentType(BodyType.HTML);
bodyItem.setContent(body);
messageToSend.setBody(bodyItem);
messageToSend.setSubject(subject);
// Contact the Office 365 service and try to add the message to
// the draft folder.
Message draft = mOutlookClient
.getMe()
.getMessages()
.add(messageToSend)
.get();
return draft.getId();
}
示例3: createAndSendMail
import com.microsoft.outlookservices.Message; //导入方法依赖的package包/类
/**
* Creates and sends an email
*
* @param emailAddress The email address of the mail recipient
* @param subject The subject of the email
* @param body The body of the email
* @return String. The id of the sent email
*/
public String createAndSendMail(
final String emailAddress,
final String subject,
final String body) throws ExecutionException, InterruptedException {
// Prepare the message.
List<Recipient> recipientList = new ArrayList<>();
Recipient recipient = new Recipient();
EmailAddress email = new EmailAddress();
email.setAddress(emailAddress);
recipient.setEmailAddress(email);
recipientList.add(recipient);
Message messageToSend = new Message();
messageToSend.setToRecipients(recipientList);
ItemBody bodyItem = new ItemBody();
bodyItem.setContentType(BodyType.HTML);
bodyItem.setContent(body);
messageToSend.setBody(bodyItem);
messageToSend.setSubject(subject);
// Contact the Office 365 service and try to deliver the message.
Message draft = mOutlookClient
.getMe()
.getMessages()
.select("ID")
.add(messageToSend)
.get();
mOutlookClient.getMe()
.getOperations()
.sendMail(draft, false)
.get();
return draft.getId();
}
示例4: replyToEmailMessage
import com.microsoft.outlookservices.Message; //导入方法依赖的package包/类
/**
* Forwards a message out of the user's Inbox folder by id
*
* @param emailId The id of the mail to be forwarded
* @param messageBody The body of the message as a string
* @return String. The id of the sent email
*/
public String replyToEmailMessage(String emailId, String messageBody)
throws ExecutionException, InterruptedException {
//Create a new message in the user draft items folder
Message replyEmail = mOutlookClient
.getMe()
.getFolder("Drafts")
.getMessages()
.getById(emailId)
.getOperations()
.createReply()
.get();
if (replyEmail != null) {
//Create a message subject body and set in the reply message
ItemBody bodyItem = new ItemBody();
bodyItem.setContentType(BodyType.HTML);
bodyItem.setContent(messageBody);
replyEmail.setBody(bodyItem);
// Send the email reply
mOutlookClient
.getMe()
.getOperations()
.sendMail(replyEmail, false)
.get();
return replyEmail.getId();
} else {
return "";
}
}
示例5: setMessage
import com.microsoft.outlookservices.Message; //导入方法依赖的package包/类
public void setMessage(Message message)
{
thisMessage = message;
this.id = message.getId();
}