none
can we parse .ics attachment which is a meeting or a appointment item? RRS feed

  • Question

  • I am developping a outlook plug-in.

    As you know,a meeting or an appointment can be forward as icalendar. At this time, we got a .ics attachment which contains the meeting or appointment's subject, body, time, location and attachments.

    The question is how can we get the meeting or appointment's subject, body, time, location and attachments, especially attachments?

    I try to use the below code to create a normal mail useing .ics attachment, but faild.

     CComVariant comVarOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR); 
    	g_pOutlookObj->get_App()->CreateItemFromTemplate(bstr, comVarOptional, &m_spNewMailItem);

    Thanks addvancelly.

    Thursday, February 16, 2017 2:19 AM

Answers

  • Hi LeoGe,

    I am not familiar C++, I would suggest you try to convert below code to C++.

    We could try NameSpace.OpenSharedItem Method (Outlook) to open ics file.

    Sub ImportICS()
    Dim cal  As MeetingItem
    Dim space As NameSpace
    Dim att As Attachment
    Set space = Application.GetNamespace("MAPI")
    Set cal = space.OpenSharedItem("D:\OfficeDev\Outlook\Import ICS.ics")
    For Each att In cal.Attachments
        att.SaveAsFile "D:\OfficeDev\Outlook\" & att.FileName
    Next att
    End Sub

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by LeoGe Friday, February 17, 2017 8:42 AM
    Friday, February 17, 2017 8:07 AM