Logout

Alt-N Discussion Groups > MDaemon Discussion Groups > MDaemon API > Programmatic Access To Calendar Data From .NET

 [F] Alt-N Discussion Groups  / MDaemon Discussion Groups  / MDaemon API  /

Programmatic Access To Calendar Data From .NET

Hi, I'd like to create/read/update/delete a MDaemon users calendar events (appointments) in an automated way from a C#.NET application running on a computer that is not the same computer that MDaemon is running on.

I contacted tech support from the vendor that sold MDaemon to my client but they told me to post in the community forums because the dev(s) monitors the forums and that would be the best hope to get an answer to my query.

The use case is that a business that I've written custom management software for is using MDaemon and they want me to automatically create appointments in each users MDaemon calendar to sync up with the appointments stored in my custom software, which is also pushing those appointments to a google calendar successfully.

In looking through posts here and the documentation i first thought i could write a C# wrapper around the MDCalendar.dll C++ (COM?) library, however the documentation in the MDaemon\API\MDCalendar.html folder is incomplete and i couldn't find an online reference.
I also see here that there is an XML API but in looking at the .htm files in the XML API folder i don't see any reference to calendar events.
I did notice that the events appear to be stored in MDaemon\User\Domain\User\Calendar.imap, in the Calendar.mrk file and can be parsed, however i'm not sure it's safe to edit that file directly to create/edit events.

My question is what is the best method, if any, to interact with the MDaemon calendar programmatically?

  All MessagesOldest ItemsOlder ItemsNewer ItemsNewest Items

Keith Personett - Jan 16, 2020 1:06 pm (#1 Total: 11)  

 

Photo of Author
Keith Personett
Newbie
Newbie
Posts: 76
Ryan,

You would use the FolderOperation and ItemOperation requests.

There is both documentation and examples in the XmlApi Help portal and on disk.

Keith Personett - Jan 16, 2020 1:31 pm (#2 Total: 11)  

 

Photo of Author
Keith Personett
Newbie
Newbie
Posts: 76
It should also be noted that the FolderOperation and ItemOperation requests are new in releases after March 2019. What version of MDaemon is your client running?

Replies to this message
  • Ryan Tomko (Jan 16, 2020 4:25 pm)


  • Keith Personett (apparently) - Jan 16, 2020 1:13 pm (#3 Total: 11)  

    via email  

    Photo of Author
    Keith Personett
    Newbie
    Newbie
    Posts: 76

    It should also be noted that the FolderOperation and ItemOperation requests are new in releases after March 2019. What version of MDaemon is your client running?

     

    Keith Personett

    Senior Software Developer, Cerebro Calibration Specialist, Agent of S.H.I.E.LD., Helicarrier Systems Analyst

    MDaemon Technologies http://www.mdaemon.com/ or on Facebook

    Sent using Outlook 2013 via ActiveSync Services for MDaemon Messaging Server.

    I 16 1018

    "You get hurt, hurt 'em back. You get killed... walk it off!"

    
    --MD-API-------------------------------------------------------------
    This list is for questions and discussions regarding MDAEMON's API.
    To unsubscribe from this mailing list send an email to
    md-api-unsubscribe@mdaemon.com .
    --POWERED BY MDAEMON!------------------------------------------------
    
    ---------------------------------------------------------------------
    These forums are provided by MDaemon Technologies for user-to-user 
    support and discussion.  MDaemon staff members may participate in the 
    forums periodically but please recognize that this is not the official
    method of receiving technical support. To receive personal technical 
    support please use the form here:
    http://www.mdaemon.com/support/request_support.asp
    ---------------------------------------------------------------------
    

    Keith Personett (apparently) - Jan 16, 2020 12:41 pm (#4 Total: 11)  

    via email  

    Photo of Author
    Keith Personett
    Newbie
    Newbie
    Posts: 76

    Ryan,

     

    You would use the FolderOperation and ItemOperation requests.

     

    There are examples in the XmlApi Help portal and on disk.

     

    Keith Personett

    Senior Software Developer, Cerebro Calibration Specialist, Agent of S.H.I.E.LD., Helicarrier Systems Analyst

    MDaemon Technologies http://www.mdaemon.com/ or on Facebook

    Sent using Outlook 2013 via ActiveSync Services for MDaemon Messaging Server.

    I 16 1018

    "You get hurt, hurt 'em back. You get killed... walk it off!"

                    - Steve Rogers/Captain America


    Ryan Tomko - Jan 16, 2020 4:25 pm (#5 Total: 11)  

     

    Photo of Author
    Ryan Tomko
    Newbie
    Newbie
    Posts: 4
    Replying to: Keith Personett (Jan 16, 2020 1:31 pm)
    It should also be noted that the FolderOperation and ItemOperation requests are new in releases after March 2019. What version...

    Thanks. They are running version 19.5.3.

    What is the URL for the online reference/documentation for the XML API? They had copied over an older version of the Docs/API folder to me which had stale info for the XML API. I'll request a fresh copy and look for FolderOperation and ItemOperation details.

    Keith Personett (apparently) - Jan 17, 2020 9:33 am (#6 Total: 11)  

    via email  

    Photo of Author
    Keith Personett
    Newbie
    Newbie
    Posts: 76

    https://{Server}:{Port}/MdMgmtWS?HelpTopic=FolderOperation

    https://{Server}:{Port}/MdMgmtWS?HelpTopic=ItemOperation

     

    https://{Server}:{Port}/MdMgmtWS?GetSample=FO_get__PRIVATE_Calendar_RES.xml

    https://{Server}:{Port}/MdMgmtWS?GetSample=IO_put__PRIVATE_Calendar_RES.xml

    https://{Server}:{Port}/MdMgmtWS?GetSample=IO_get__PRIVATE_Calendar_RES.xml

    https://{Server}:{Port}/MdMgmtWS?GetSample=IO_change__PRIVATE_Calendar_RES.xml

     

    If you are creating a service to modify data in various mailboxes, you will be making FO and IO calls with the path attribute beginning with MAILBOX\ (as opposed to PRIVATE\) and the account attribute must be specified. The Account making the API request has to have permission to access the folders and items. This can be done one of two ways.

     


    Keith Personett - Jan 17, 2020 9:51 am (#7 Total: 11)  

     

    Photo of Author
    Keith Personett
    Newbie
    Newbie
    Posts: 76
    https://{Server}:{Port}/MdMgmtWS?GetSample=FO_get__PRIVATE_Calendar_RES.xml
    https://{Server}:{Port}/MdMgmtWS?GetSample=IO_put__PRIVATE_Calendar_RES.xml
    https://{Server}:{Port}/MdMgmtWS?GetSample=IO_get__PRIVATE_Calendar_RES.xml
    https://{Server}:{Port}/MdMgmtWS?GetSample=IO_change__PRIVATE_Calendar_RES.xml

    If you are creating a service to modify data in various mailboxes, you will be making FO and IO calls with the path attribute beginning with MAILBOX/ (as opposed to PRIVATE/) and the account attribute must be specified. The Account making the API request has to have permission to access the folders and items. This can be done one of two ways.

    1) Your service is using an MDaemon Account, which has permissions to all of the calendar folders it is modifying. This means can be easily broken by a mailbox owner removing that permission, and requires the use of a licensed MDaemon account.

    Or

    2) Your customer, using a Global Admin Account, via the XML API, could create an API Service account (https://{Server}:{Port}/MdMgmtWS?GetSample=ServiceAccount_Create_RES.xml ). Any management of API Service Accounts requires Global Admin Permission, which is why perhaps your customer would have to do this for you or provide you with a temporary Global Admin account to do it yourself. This creates an XmlApi Logon that is not an MDaemon User, and has functionality limited to specific operations and domains. In the ServiceAccountCreate request, you should
    a. include any domains it requires access to.
    (Domains)
    (Domain delete="0" update="0" append="0" read="1" list="1" action="allow" name="avengers.int"/)
    (Domain delete="0" update="0" append="0" read="1" list="1" action="allow" name="heroes4hire.int"/)
    (/Domains)
    b. Include any Operations that it is allowed to perform such as
    (Operations)
    (Operation delete="0" update="0" append="0" read="1" list="1" name="FolderOperation"/)
    (Operation delete="1" update="1" append="1" read="1" list="1" name="ItemOperation"/)
    (/Operations)
    c. After you create the API Service account, you would then issue a ServiceAccountUpdate request with the Account ID and an empty PasswordReset Element (see https://{Server}:{Port}/MdMgmtWS?GetSample=ServiceAccount_PwReset_RES.xml ). This will generate and provide you with the password for the service account.
    d. Now you have an API logon that is strictly limited to specific functionality on specific domains, which cannot be broken by a mailbox owner messing with permissions.
    e. Service accounts authenticate the same way that normal MDaemon logons authenticate, basic authentication, just no domain value.
    i. ie. {gQ4mJ80F-fUin-W29H-AzR4-8db44AmF0t2O:{6oMwI1VO-47Q5-e9O7-ZK62-zJvZg5PrSN89}

    Both ways have specific benefits. The benefit of using an API Service Account, is that as users/mailboxes are added, it doesnt require additional setting to ensure that it works. As long as that new mailbox is within a domain that the service account is allowed to access, it will work.

    Ryan Tomko - Jan 30, 2020 5:14 pm (#8 Total: 11)  

     

    Photo of Author
    Ryan Tomko
    Newbie
    Newbie
    Posts: 4
    Thanks for the help, i've been able to successfully create and edit calendar events via the XML API from C#, after testing in Postman.

    I've run into an issue with the "Item" last modified timestamp. It seems to be not using the timezone correctly when an edit is made in the web UI. Here are the steps to reproduce:

    1) Edit an event using the website UI (see image)
    2) Get the event from API with Postman and notice the lastModified value: "2020-01-30T16:04:50.000Z"
    3) Edit the event subject using "put" via XML API in Postman

    Notice that the lastModified when edited by Postman is the correct Zulu time (2020-01-30T22:08:28.394Z), but when edited directly in the web UI the timestamp is the local time (2020-01-30T16:04:50.000Z), not the Zulu time. This is incorrect.



    Is this a bug in the web UI that can be fixed? I'm using the last modified timestamp to sync event data between MDaemon and another system and the last modified time lets me know which way to push or pull the data.

    [Last Editor: Ryan Tomko, Jan 30, 2020 5:16 pm. Total Edits: 1]


    step1

    Keith Personett (apparently) - Jan 30, 2020 8:14 pm (#9 Total: 11)  

    via email  

    Photo of Author
    Keith Personett
    Newbie
    Newbie
    Posts: 76
    Ryan,

    As long as the lastModified stamp is different from what you've previously recorded, the the item has changed. It is probably a difference between Local time and Zulu (GMT) time.

    Keith Personett
    Senior Software Developer, Cerebro Calibration Specialist, Agent of S.H.I.E.LD., Helicarrier Systems Analyst
    MDaemon Technologies http://www.mdaemon.com/ or on Facebook
    Sent using Outlook 2013 via ActiveSync Services for MDaemon Messaging Server.


    "If you try to escape, or play any sort of games with me, I will taze you and watch Supernanny while you drool into the carpet."
        -- Agent Phil Coulson, S.H.I.E.L.D.

    From: Ryan Tomko
    Sent: ‎1/‎30/‎2020 16:14
    To: md-api List Member
    Subject: [md-api] Programmatic Access To Calendar Data From .NET


    From : Ryan Tomko [lists-md-api@mdaemon.com]
    To : md-api List Member [md-api@mdaemon.com]
    Date : Thursday, January 30 2020 16:14:25
    Thanks for the help, i've been able to successfully create and edit calendar events via the XML API from C#, after testing in Postman.

    I've run into an issue with the "Item" last modified timestamp. It seems to be not using the timezone correctly when an edit is made in the web UI. Here are the steps to reproduce:

    1) Edit an event using the website (see image)
    2) Check values from API with Postman:
    <MDaemon>
        <API>
            <Request verbose="0" echo="1" version="19.5.3">
                <Operation>ItemOperation</Operation>
                <Parameters>
                    <Item action="get" type="event" path="PRIVATE/Calendar" ID="12"/>
                </Parameters>
            </Request>
            <Response version="19.5" session="08DD5D9C" et="0.002958">
                <Status id="0" value="0x00000000" message="The operation completed successfully."/>
                <ServiceVersion>19.5.3.7</ServiceVersion>
                <Result>
                    <Item action="get" path="PRIVATE/Calendar" ID="12" type="event" lastModified="2020-01-30T16:04:50.000Z">
                        <Private>No</Private>
                        <AllDay>No</AllDay>
                        <Priority>1</Priority>
                        <ReminderSet>No</ReminderSet>
                        <ReminderMin>0</ReminderMin>
                        <Sequence>0</Sequence>
                        <AppointmentLocation>No</AppointmentLocation>
                        <TentativePlaceholder>No</TentativePlaceholder>
                        <BusyStatus>2</BusyStatus>
                        <IntendedBusyStatus>2</IntendedBusyStatus>
                        <Subject length="6">
                            

    Attachment: step1.png



    View/reply at Programmatic Access To Calendar Data From .NET
    
    --MD-API-------------------------------------------------------------
    This list is for questions and discussions regarding MDAEMON's API.
    To unsubscribe from this mailing list send an email to
    md-api-unsubscribe@mdaemon.com .
    --POWERED BY MDAEMON!------------------------------------------------
    
    ---------------------------------------------------------------------
    These forums are provided by MDaemon Technologies for user-to-user 
    support and discussion.  MDaemon staff members may participate in the 
    forums periodically but please recognize that this is not the official
    method of receiving technical support. To receive personal technical 
    support please use the form here:
    http://www.mdaemon.com/support/request_support.asp
    ---------------------------------------------------------------------
    

    Replies to this message
  • Ryan Tomko (Feb 5, 2020 11:13 am)


  • Ryan Tomko - Feb 5, 2020 11:13 am (#10 Total: 11)  

     

    Photo of Author
    Ryan Tomko
    Newbie
    Newbie
    Posts: 4
    Replying to: Keith Personett (Jan 30, 2020 8:14 pm)
    Ryan,As long as the lastModified stamp is different from what you've previously recorded, the the item has changed. It is...

    Just knowing the lastModified stamp is different is not sufficient since edits could be taking place in both my custom software and in MDaemon web UI for the same appt event and i want to know which edit was the most recent, thus i need to compare the lastModified stamp values.
    The problem is that when a user edits an appt event in the MDaemon web UI the lastModified value is local time, not UTC. But when edited via the XML API the lastModified value is UTC. This is not consistent and makes it impossible to rely on the value.

    Can you confirm this is a bug in MDaemon, and can it be fixed?

    Keith Personett (apparently) - Feb 5, 2020 3:53 pm (#11 Total: 11)  

    via email  

    Photo of Author
    Keith Personett
    Newbie
    Newbie
    Posts: 76

    I can see about making a change for Version 20 which is about to go to beta.

     

    As far as any version prior to that, it would have to be a One-Off private build, IF I was even allowed to publish a post 19.5.4 update.

     

    When you make an edit via your software, you retain/store the new lastModified timestamp that the response returns, correct?

     

                         <Result>

                               <Item action="change" path="PRIVATE/Calendar" ID="1" lastModified="2020-02-05T20:41:21.779Z"/>

     

    As long as any subsequent “get” action returns a value that doesn’t match precisely, down to the millisecond, the one returned in the response to the change or put action, then it was updated externally since/after your software last edited it.

     

    I tend to use UTC for as much as possible, since one doesn’t always know where a client making the request is located. We have some legacy code in other modules that still use the server’s local time for things like this, which makes it impossible for a client to render an accurate representation of when an item was last updated since the server doesn’t always know the time zone of the client making the request.

    
    --MD-API-------------------------------------------------------------
    This list is for questions and discussions regarding MDAEMON's API.
    To unsubscribe from this mailing list send an email to
    md-api-unsubscribe@mdaemon.com .
    --POWERED BY MDAEMON!------------------------------------------------
    
    ---------------------------------------------------------------------
    These forums are provided by MDaemon Technologies for user-to-user
    support and discussion.  MDaemon staff members may participate in the
    forums periodically but please recognize that this is not the official
    method of receiving technical support. To receive personal technical
    support please use the form here:
    http://www.mdaemon.com/support/request_support.asp
    ---------------------------------------------------------------------
    



      All MessagesOldest ItemsOlder ItemsNewer ItemsNewest Items



     Content:

    Read New | Search

     Guest:

    Email to Admin



    You are visiting as a Guest user.