Community
Showing results for 
Search instead for 
Do you mean 
Reply

Activity Code Samples For e-mail Merge Please Help

Astute Commentator
Posts: 11
Country: United States

Activity Code Samples For e-mail Merge Please Help

I am working on creating a list of a days' activities (or a lookup and work from there) and then creating an email of those activites for office appointment remiders since the activity e-mail template is not accesible in Act 2009 and does not look like it is in 2010 either.

 

This needs to be done for each activity Any code (C# is best but will take VB of course) to help me pull a day's activities and extract the essential field of who, when, what, e-mail would be very helpful.

 

I am becoming more fluent in the ACT SDK coding but find the activity extraction (the actual activity details) bewildering from the reference material and do not want to reinvent the wheel. I do best with taking code samples as a base.

 

I know the essential detals of each activity pop up in a window when we mouse over them on the calender - even code to duplicate that would allow me to figure out access to these details. 

 

If you would rather not post or a looking for reasonable compensation, my e-mail is docb@naturalholistic.com and I am hoping a few of you can help

 

Thank you in advance

 

Larry

Astute Commentator
Posts: 11
Country: United States

Re: Activity Code Samples For e-mail Merge Please Help

If I asked for too much or seem to "green" for this group, then how about just pointing me in a direction for more detailed reading if no one has any code snippets to share.

 

Larry

Nickel Elite Contributor
Posts: 937
Country: USA

Re: Activity Code Samples For e-mail Merge Please Help

Do you have a requirement on the version of ACT! you want this for?  For what you are describing you can access the Activity API's or potentially use OLEDB2 Provider to extract the days Activities - OLEDB2 provider is only available in ACT! 2010 or higher.  I have an example of OLEDB2 provider usage in code in the devnet download site.  Taking the OLEDB2 approach would allow your code to exist outside of any ACT! references (though you would need to have the provider installed where you intend to run your code from).  

 

 

 

 

Nickel Elite Contributor
Posts: 937
Country: USA

Re: Activity Code Samples For e-mail Merge Please Help

 Here's some pretty close pseudo code in c# using the OLEDB2 provider extracting info for Activities:
 
 public static string whateveryouwannanameme
        {
            get
            {
                string connectionString = "File Name=connection.udl"; 
                string yourvariable = null;

                try
                {
                    // open connection
                    using (OleDbConnection con = new OleDbConnection(connectionString))
                    {
                        con.Open();
                        OleDbCommand cmd = con.CreateCommand();

                        // select statement
                        cmd.CommandText = "Select dbo.ACTIVITY.START_DATE_TIME, dbo.ACTIVITY.DETAILS, dbo.ACTIVITY.LOCATION, dbo.ACTIVITY.ORGANIZER From dbo.ACTIVITY where dbo.activity.start_date_time > getdate() and dbo.activity.start_date_time < getdate() +1  '";

                        // execute query
                        OleDbDataReader rdr = cmd.ExecuteReader();

                        // read data
                        while (rdr.Read())
                        {
                            yourvariable = (string)rdr["Details"];
                        }
                        rdr.Close();

                        return yourvariable;
                    }
                }
                catch (OleDbException ex)
                {
                    
                    return "oledb catch" + ex.Message;
                }
                catch (Exception ex)
                {
                    return ex.Message;
                }

            }
        }
Astute Commentator
Posts: 11
Country: United States

Re: Activity Code Samples For e-mail Merge

[ Edited ]

Allen:

 

Thank you for your reply. I am currently developing this for version 2009 Standard. I was hoping to develop something that would also be viable for anyone else with this reminder e-mail issue due to the time involved. If there were an available add-on I would have gladly paid for it.

 

I am open to upgrading and developing it only for version 2010  unless anyone has other ideas that are less version specific.

 

Thank you for jumping in. I can usually find my way through from documentation and samples but felt at a loss on this/

 

  Larry

Message Edited by drdocb on 10-06-2009 12:55 PM
Nickel Elite Contributor
Posts: 937
Country: USA

Re: Activity Code Samples For e-mail Merge

For ACT! 2009 and previous - there are SDK methods to return a filtered Activity collection, but as you point out there isn't a lot of example/reference code on these methods that I've run across.  I'll check some of my older sample code to see if I have an example using the SDK to get Activities.  
Nickel Super Contributor
Posts: 441
Country: UK

Re: Activity Code Samples For e-mail Merge

In vb but hopefully it will give you something to work with....

'create the sort criteria to sort the activities in ascending order Dim sCriteria As New Act.Framework.Activities.ActivitySortCriteria(ActApp.ActFramework.Activities.GetFieldDescriptor("STARTTIME"), System.ComponentModel.ListSortDirection.Ascending) 'get the activities and sort them by date Dim aList As Act.Framework.Activities.ActivityList aList = ActApp.ActFramework.Activities.GetActivityList(sCriteria, Nothing, Now.Date, Now.Date.AddDays(1)) 'loop the activities For Each activity As Act.Framework.Activities.Activity In aList 'you can access activity details through its properties, some examples below MsgBox(activity.Type.Name & " " & activity.StartTime & " " & activity.EndTime) 'we can get the contacts associated with the activity for things like email addresses Dim contacts As Act.Framework.Activities.ActivityContactCollection = activity.ActivityContacts Dim ids As New ArrayList For Each activityContact As Act.Framework.Activities.ActivityContact In contacts ids.Add(activityContact.Key) Next 'get the contacts as a list Dim cList As Act.Framework.Contacts.ContactList = ActApp.ActFramework.Contacts.GetContactsByID(Nothing, ids.ToArray(GetType(System.Guid))) 'do something with the contacts For Each Contact As Act.Framework.Contacts.Contact In cList MsgBox(Contact.Fields("Contact.E-mail", False)) Next Next

 

 

 Tom