aspose-free-consulting / projects

The starting point for Aspose free consulting projects
5 stars 5 forks source link

Import EML files into an Office 365 Shared Mailbox #380

Closed brianstittsr closed 2 months ago

brianstittsr commented 4 months ago

Please check if it satisfies the following requirements:

If your requirement is actually a bug in our APIs or a feature request for our APIs then please use our forum to report it and get quick help: https://forum.aspose.com/

If all the above requirements are satisfied then please move on:

< describe your free consulting project requirements briefly>

I want assistance with learning how to use the Apose Python library to import .EML files in a folder into an Office 365 Mailbox. I just need a simple working python example so I can integrate it with my ETL tool. The EML files will be stored in a directory on a server that I will have local access to read from. My plan is configure the Python program to accept the following variables as input :

  1. Server URL
  2. Path to Shared MailBox
  3. Apose O365 Oauth sign in credientials

I have a test the import on if needed.

< which platform you're working on -- operating system, development environment etc.> The EML import solution will be hosted on a Linux server and the files will be stored on the Linux server. If there's no difference between Windows or Linux, I will be ok with testing on Linux.

dmitrysamodurov commented 3 months ago

Hello @brianstittsr,

Unfortunately, the Aspose.Email for Python library doesn't provide a direct API for accessing Office 365 Shared Mailboxes via Exchange Web Services (EWS) or Microsoft Graph.

However, you might want to explore Aspose.Email for .NET or Aspose.Email for Java. These libraries offer more extensive capabilities, including the ability to work with Office 365 Shared Mailboxes without the mentioned limitations.

brianstittsr commented 3 months ago

Hi,The ETL solution I am using is based on Java, therefore Java can be an option. Can you share with me how to import the EMLs using the Java solution?Brian StittOn Jan 22, 2024, at 4:04 AM, dmitrysamodurov @.***> wrote: Hello @brianstittsr, Unfortunately, the Aspose.Email for Python library doesn't provide a direct API for accessing Office 365 Shared Mailboxes via Exchange Web Services (EWS) or Microsoft Graph. However, you might want to explore Aspose.Email for .NET or Aspose.Email for Java. These libraries offer more extensive capabilities, including the ability to work with Office 365 Shared Mailboxes without the mentioned limitations.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

sergviva commented 3 months ago

Hello @brianstittsr,

Sorry for the late reply. Shared MailBox code sample:

ITokenProvider provider = new AzureROPCTokenProvider(tenant, clientId, "", userName, pwd, new String[]{"https://outlook.office.com/EWS.AccessAsUser.All"});
NetworkCredential credentials = new OAuthNetworkCredential("shared_1@xxx.onmicrosoft.com", provider);

try (IEWSClient client = EWSClient.getEWSClient(ExchangeVersion.Exchange2016,
        "https://outlook.office365.com/ews/exchange.asmx", credentials, null)) {
    MailMessage eml = new MailMessage("test1@xxx.onmicrosoft.com", "test2@xxx.onmicrosoft.com", "test shared", "body");
    client.appendMessage("Inbox", eml);
    //credentials.setUserName("shared_2@xxx.onmicrosoft.com");
    //...
}

The AzureROPCTokenProvider implementation is described in the link: https://docs.aspose.com/email/java/microsoft-graph-utility-features/