当前位置: 首页>>代码示例>>Java>>正文


Java BodyType类代码示例

本文整理汇总了Java中com.microsoft.outlookservices.BodyType的典型用法代码示例。如果您正苦于以下问题:Java BodyType类的具体用法?Java BodyType怎么用?Java BodyType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BodyType类属于com.microsoft.outlookservices包,在下文中一共展示了BodyType类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setSubject

import com.microsoft.outlookservices.BodyType; //导入依赖的package包/类
public void setSubject(String Subject)
{
    subject = Subject;
    if (this.itemBody != null)
    {
        this.itemBody.setContent(Subject);
        this.itemBody.setContentType(BodyType.Text);
        thisEvent.setSubject(Subject);
    }
}
 
开发者ID:mirontoli,项目名称:andpoint,代码行数:11,代码来源:O365CalendarModel.java

示例2: setSubject

import com.microsoft.outlookservices.BodyType; //导入依赖的package包/类
public void setSubject(String Subject)
{
    subject = Subject;
    if (this.itemBody != null)
    {
        this.itemBody.setContent(Subject);
        this.itemBody.setContentType(BodyType.Text);
        thisMessage.setSubject(Subject);
    }
}
 
开发者ID:mirontoli,项目名称:andpoint,代码行数:11,代码来源:O365MailItemsModel.java

示例3: addDraftMail

import com.microsoft.outlookservices.BodyType; //导入依赖的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();
}
 
开发者ID:OfficeDev,项目名称:O365-Android-Snippets,代码行数:41,代码来源:EmailSnippets.java

示例4: createAndSendMail

import com.microsoft.outlookservices.BodyType; //导入依赖的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();
}
 
开发者ID:OfficeDev,项目名称:O365-Android-Snippets,代码行数:45,代码来源:EmailSnippets.java

示例5: replyToEmailMessage

import com.microsoft.outlookservices.BodyType; //导入依赖的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 "";
    }
}
 
开发者ID:OfficeDev,项目名称:O365-Android-Snippets,代码行数:40,代码来源:EmailSnippets.java

示例6: execute

import com.microsoft.outlookservices.BodyType; //导入依赖的package包/类
@Override
public String execute() {
    boolean isSucceeding;
    AuthenticationController
            .getInstance()
            .setResourceId(getO365MailResourceId());
    CalendarSnippets calendarSnippets = new CalendarSnippets(getO365MailClient());
    ODataSystemQuerySnippets oDataSystemQuerySnippets = new ODataSystemQuerySnippets();

    try {
        //Set up one important event to test with
        Event testEvent = new Event();
        testEvent.setSubject(getStringResource(R.string.calendar_subject_text));

        //Set body on test event
        ItemBody itemBody = new ItemBody();
        itemBody.setContent(getStringResource(R.string.calendar_body_text));
        itemBody.setContentType(BodyType.HTML);
        testEvent.setBody(itemBody);

        //Set start and end time for event
        Calendar eventTime = Calendar.getInstance();
        testEvent.setStart(eventTime);
        eventTime.add(Calendar.HOUR_OF_DAY, 2);
        testEvent.setIsAllDay(false);
        testEvent.setEnd(eventTime);
        testEvent.setImportance(Importance.High);

        //Create test event on tenant
        testEvent = calendarSnippets.createCalendarEvent(testEvent);

        //Retrieve important events (should include our test event)
        List<Event> importantEvents = oDataSystemQuerySnippets.getImportantEventsUsing$filter(getO365MailClient());

        //Check that all events are important to determine if story succeeded.
        isSucceeding = true;
        for (Event event : importantEvents) {
            if (event.getImportance() != Importance.High) {
                isSucceeding = false;
                break;
            }
        }

        //Delete test event from tenant
        calendarSnippets.deleteCalendarEvent(testEvent.getId());

    } catch (ExecutionException | InterruptedException e) {
        return FormatException(e, STORY_DESCRIPTION);
    }
    if (isSucceeding) {
        return StoryResultFormatter.wrapResult(STORY_DESCRIPTION + ": Important events found.", true);
    } else {
        return StoryResultFormatter.wrapResult(STORY_DESCRIPTION + ": Important events not found.", false);
    }
}
 
开发者ID:OfficeDev,项目名称:O365-Android-Snippets,代码行数:56,代码来源:ODataFilterStory.java

示例7: createCalendarEvent

import com.microsoft.outlookservices.BodyType; //导入依赖的package包/类
/**
 * Creates an event
 *
 * @param subject           The subject of the event
 * @param itemBodyHtml      The body of the event as HTML
 * @param startDate         The start date of the event
 * @param endDate           The end date of the event
 * @param attendeeAddresses A list of attendee email addresses
 * @return String The id of the created event
 */
public String createCalendarEvent(
        String subject
        , String itemBodyHtml
        , java.util.Calendar startDate
        , Calendar endDate
        , List<String> attendeeAddresses)
        throws ExecutionException
        , InterruptedException {
    Event newEvent = new Event();
    newEvent.setSubject(subject);

    //Create an event item body with HTML formatted text
    ItemBody itemBody = new ItemBody();
    itemBody.setContent(itemBodyHtml);
    itemBody.setContentType(BodyType.HTML);

    //Fill new calendar event with body, start date, all day flag
    //and end date
    newEvent.setBody(itemBody);
    newEvent.setStart(startDate);
    newEvent.setIsAllDay(false);
    newEvent.setEnd(endDate);

    Matcher matcher;
    List<Attendee> attendeeList = new ArrayList<>();
    for (String attendeeAddress : attendeeAddresses) {
        // Add mail to address if mailToString is an email address
        matcher = Patterns.EMAIL_ADDRESS.matcher(attendeeAddress);
        if (matcher.matches()) {
            EmailAddress emailAddress = new EmailAddress();
            emailAddress.setAddress(attendeeAddress);
            Attendee attendee = new Attendee();
            attendee.setEmailAddress(emailAddress);
            attendeeList.add(attendee);
        }
    }
    newEvent.setAttendees(attendeeList);


    return mCalendarClient
            .getMe()
            .getEvents()
            .select("ID")
            .add(newEvent).get().getId();
}
 
开发者ID:OfficeDev,项目名称:O365-Android-Snippets,代码行数:56,代码来源:CalendarSnippets.java

示例8: updateCalendarEvent

import com.microsoft.outlookservices.BodyType; //导入依赖的package包/类
/**
 * Updates the subject, body, start date, end date, or attendees of an event
 *
 * @param subject      The subject of the event
 * @param allDay       true if event spans a work day
 * @param itemBodyHtml The body of the event as HTML
 * @param startDate    The start date of the event
 * @param endDate      The end date of the event
 * @param attendees    A list of attendee email addresses
 * @return String The id of the created event
 */
public Event updateCalendarEvent(
        String eventId
        , String subject
        , boolean allDay
        , String itemBodyHtml
        , java.util.Calendar startDate
        , Calendar endDate
        , List<String> attendees) throws ExecutionException, InterruptedException {
    Event calendarEvent = getCalendarEvent(eventId);
    calendarEvent.setSubject(subject);
    if (itemBodyHtml != null && itemBodyHtml.length() > 0) {
        ItemBody itemBody = new ItemBody();
        itemBody.setContent(itemBodyHtml);
        itemBody.setContentType(BodyType.HTML);
        calendarEvent.setBody(itemBody);
    }
    if (startDate != null) {
        calendarEvent.setStart(startDate);
    }
    if (endDate != null) {
        calendarEvent.setEnd(endDate);
    }

    calendarEvent.setIsAllDay(allDay);

    if (attendees != null && attendees.size() > 0) {
        //clear attendee list and set with new list
        calendarEvent.setAttendees(null);
        List<Attendee> attendeeList = convertEmailStringsToAttendees(attendees);
        calendarEvent.setAttendees(attendeeList);
    }

    return mCalendarClient
            .getMe()
            .getEvents()
            .getById(eventId)
            .select("Subject")
            .update(calendarEvent)
            .get();

}
 
开发者ID:OfficeDev,项目名称:O365-Android-Snippets,代码行数:53,代码来源:CalendarSnippets.java


注:本文中的com.microsoft.outlookservices.BodyType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。