Zugriff auf Microsoft365 E-Mail Postfach
<Batch ActionLog="true" ConditionLog="false">
<Set Variable="{@UserPrincipalName}" Value="[email protected]" />
<Set Variable="{@QuellFolderID}" Value="inbox" />
<Set Variable="{@ZielFolderID}" Value="inbox" />
<SQLConnect Connection="{@myConnection}" Server="{@SQLServer}" Database="{@SQLDatabase}" User="{@SQLUsername}" Password="{@SQLPassword}" />
<Microsoft365MailFolderList Data="{@myFolder}" UserPrincipalName="{@UserPrincipalName}" Account="{@Account:Office}" />
<ForEach Data="{@myFolder}">
<Select Case="{@Data:displayName}">
<Case Value="Quelle">
<Set Variable="{@QuellFolderID}" Value="{@Data:id}" />
</Case>
<Case Value="Ziel">
<Set Variable="{@ZielFolderID}" Value="{@Data:id}" />
</Case>
</Select>
</ForEach>
<Microsoft365MailList Data="{@myEmails}" FolderId="{@QuellFolderID}" UserPrincipalName="{@UserPrincipalName}" Account="{@Account:Office}" />
<DataCopy Data="{@myEmails}" DataCopy="{@myEmailsFiltered}" Where="toRecipients Like('%[email protected]%')" />
<ForEach Data="{@myEmailsFiltered}">
<Set Variable="{@Subject}" Value="{@Data:subject}" />
<Microsoft365MailRead MailId="{@Data:id}" HtmlBody="true" UserPrincipalName="{@UserPrincipalName}" Account="{@Account:Office}" Variable="{@HtmlBody}" />
<SQLExecute Query="INSERT INTO ..." Connection="{@myConnection}" Variable="{@Result}" />
<CreateNewGuid Variable="{@Guid}" />
<Set Variable="{@Path}" Value="C:\temp\{@Guid}\" />
<PathCreate Path="{@Path}" Variable="{@Result}" />
<Microsoft365MailAttachmentDownloadAll MailId="{@Data:id}" DestinationFolder="{@Path}" UserPrincipalName="{@UserPrincipalName}" Account="{@Account:Office}" />
<Microsoft365MailExportToEml MailId="{@Data:id}" DestinationFolder="{@Path}" FileName="export.eml" UserPrincipalName="{@UserPrincipalName}" Account="{@Account:Office}" Variable="{@Result}" />
<Microsoft365MailMove MailId="{@Data:id}" DestinationFolderId="{@ZielFolderID}" UserPrincipalName="{@UserPrincipalName}" Account="{@Account:Office}" />
</ForEach>
</Batch>