locked
Workflow for fixing email aliases RRS feed

  • Question

  • Hi.

    I'm trying to figure out how to do a workflow for fixing an users mail aliases upon change of the primary mail address. The idea is that when a person changes name, the primary address changes and then the old primary address gets to live on for a while as an alias and later get removed. I have synked over ProxyAddresses from AD to the attribute ProxyAddressCollection (which is thus containing all aliases prefixed with smtp: plus the primary address prefixed with SMTP:) and from a previous activity in the workflow, [//WorkflowData/MailAddress] contains the targets new primary mail address. Now I need my workflow to do the following operations:

    1. Check if [//Target/ProxyAddressCollection] contains the new address prefixed with SMTP: (case sensitive). If it does, no need to do anything more.

    2. Find the old primary address in the collection (the one with SMTP:) and change it to lowercase smtp: instead. Also copy it over to the multi value attribute [//Target/extAddressesToBeRemoved] for later complete removal.

    3. Insert [//WorkflowData/MailAddress] into [//Target/ProxyAddressCollection] prefixed with SMTP:

    I'd be happy if I were to do all this in the workflow directly, but I can't seem to find the functions needed. For example the Contains function is of no use here since it's case insensitive. Is this at all possible or would I need to pass over the list to a powershell script and build the logic there instead?

    This feels like natural stuff to do to me, surprised I haven't found any blog post containing a nice howto :-)

    Monday, May 8, 2017 7:08 AM

Answers

  • Not sure if there is any blog out there, but you'll have to first run Iteration feature on ProxyAddressCollection. That will allow you to inspect each and every value and find out current primary SMTP address and store it in temp WorkflowData variables. Then in the second activity, update the ProxyAddressCollection values as required using RemoveValues / InsertValues functions. Something like attached workflow.

    Monday, May 8, 2017 8:32 AM

All replies

  • Not sure if there is any blog out there, but you'll have to first run Iteration feature on ProxyAddressCollection. That will allow you to inspect each and every value and find out current primary SMTP address and store it in temp WorkflowData variables. Then in the second activity, update the ProxyAddressCollection values as required using RemoveValues / InsertValues functions. Something like attached workflow.

    Monday, May 8, 2017 8:32 AM
  • Not sure if there is any blog out there, but you'll have to first run Iteration feature on ProxyAddressCollection. That will allow you to inspect each and every value and find out current primary SMTP address and store it in temp WorkflowData variables. Then in the second activity, update the ProxyAddressCollection values as required using RemoveValues / InsertValues functions. Something like attached workflow.

    Ah! Exactly what I was looking for! I totally missed the Iteration feature. Now I have something to chew on for the next few hours :-D Thanks a lot!

    edit: Just for the record: One hour later this works like a charm. I don't know what I'd do without MIMWAL...

    Monday, May 8, 2017 8:51 AM
  • Hi,

    Would it be possible to post the complete solution here?

    Or add it to the MIMWAL Real World Examples?

    https://github.com/Microsoft/MIMWAL/wiki/Scenarios


    Did my post help? Please use "Vote As Helpful", "Mark as answer" or "Propose as answer". Thank you!

    Friday, May 19, 2017 9:51 AM
  • Would it be possible to post the complete solution here?

    Or add it to the MIMWAL Real World Examples?

    https://github.com/Microsoft/MIMWAL/wiki/Scenarios


    Sounds like a good idea. I've never edited anything on github wiki before though and I see no edit button. Do I need to apply for edit permissions somewhere?
    Friday, May 19, 2017 11:24 AM
  • The easiest way to do this will be someone writes a TechNet wiki or a personal blog post and provides a link to put on MIMWAL Real World Examples wiki.
    Monday, May 22, 2017 9:28 AM
  • Hi.

    I've now made a guide on Technet Wiki. My first one ever, so don't be too hard on me :-)

    https://social.technet.microsoft.com/wiki/contents/articles/37997.howto-create-mimwal-workflow-for-changing-e-mail-address-draft.aspx

    (I've never ever in my life seen an editor that is crappier than the one on Technet wiki. Starting to regret I tried putting anything there. When you read this it might be the case that the guide is cut in half or looking really bad. I'm trying to fix it with minimal success...)
    Wednesday, May 31, 2017 12:42 PM
  • Great work Daniel, thanks! :)

    Did my post help? Please use "Vote As Helpful", "Mark as answer" or "Propose as answer". Thank you!

    Monday, June 5, 2017 9:19 AM
  • Did @nilesh have any input on the guide? Otherwise I'll remove the "draft" from the name and ask you to put a link on the MIMWAL examples wiki page.
    Wednesday, June 7, 2017 7:10 AM
  • Good write-up, implementation as well as problem context well explained. Just for completeness, you can also provide a little context on what triggers this workflow. I'll link this up on the GitHub shortly.
    Wednesday, June 7, 2017 8:40 AM
  • Good write-up, implementation as well as problem context well explained. Just for completeness, you can also provide a little context on what triggers this workflow. I'll link this up on the GitHub shortly.

    Added a sentence suggesting how to trigger the workflow. Thanks!

    Also changed the title removing "draft". Thus the url changed (to https://social.technet.microsoft.com/wiki/contents/articles/37997.howto-create-mimwal-workflow-for-changing-e-mail-address.aspx), but the url you used on github seems to continue to work.

    /Daniel

    Wednesday, June 7, 2017 10:12 AM