Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic double dictionnary key when importing outlook (Read 8266 times)
greg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Oct 31st, 2008
double dictionnary key when importing outlook
Oct 31st, 2008 at 11:52am
Print Post  
Hello,

I have a problem with the use of the Planner. I import appointment from an outlook calendar (I use the function convertfrom of the class ItemConverter) to display in the calendar planner.
No problem with standard appointment, but when the appointment is reccursive (ie with periodicity) the planner throw me an exception "dictionnary key already added : mindfusion.appointment" !
Did someone already got this problem ?
Is there a known solution ?
Many thanks in advance.
Greg.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: double dictionnary key when importing outlook
Reply #1 - Oct 31st, 2008 at 1:57pm
Print Post  
Can you post the code you are using to import the recurrent appointment? Do you use the OutlookImporter class supplied with Planner.NET or you are using some kind of manual processing? Where is this ItemConverter class you were talking about?

Meppy
  
Back to top
 
IP Logged
 
greg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Oct 31st, 2008
Re: double dictionnary key when importing outlook
Reply #2 - Oct 31st, 2008 at 2:13pm
Print Post  
Hi Meppy,

Yes I use the class supplied with the planner.
In namespace MindFusion.Scheduling.Outlook
The file is called ItemConverter.cs in source code.
I just comment the part with description and attendees to avoid the outlook security exception.
I do not need description and attendees.

Thanks.

Here is the part I comment :

Code
Select All
		// Add required attendees if exists
		String attendees = outlookAppointment.RequiredAttendees;
		if (attendees != null && attendees != String.Empty)
		{
		    String[] contacts = attendees.Split(Convert.ToChar(";"));
		    foreach (String _contact in contacts)
		    {
			  string contact = _contact.Trim(' ', '\'');
			  if (contact != String.Empty)
			  {
				Contact c = new Contact();
				c.FirstName = contact;
				item.Contacts.Add(c);
			  }
		    }
		}

		item.DescriptionText = outlookAppointment.Body;
		item.DescriptionText = outlookAppointment.Body;
 



Here you have a view of the exception (in french) :


  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: double dictionnary key when importing outlook
Reply #3 - Nov 3rd, 2008 at 7:38am
Print Post  
I will recommend using the OutlookImporter class instead. The ItemConverter class is internal and is not meant to be used directly from client code. Once you create an instance of the OutlookImporter class, use its ImportItems method in order to import the items from Outlook.

Meppy
  
Back to top
 
IP Logged
 
greg
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Joined: Oct 31st, 2008
Re: double dictionnary key when importing outlook
Reply #4 - Nov 3rd, 2008 at 2:32pm
Print Post  
Thanks Meppy for your answer Smiley
I tried with the original OutlookImporter class, but the same result occurs. I tried that just for fun
because I cannot use the code "as this" cause of the outlook security alert which is thrown each time the attendee or the decription property is read.
So I continued to use my custom code and I finally find why the dictionnary key exception is throw !
I will try to explain. Take the exemple of a daily appointment.
I want to display the calendar of a week.
Outlook will give me 7 appointments (one per day) and each of those have the same EntryID.
When importing, the planner.net wil get the first one, see that it's a recursive appointment and will create the 6 others for the displayed week. Next, the planner get the second appointment and attempt to create it but already exist and then throw the dictionnary key exception.
So I have founded a solution to avoid this exception. Maybe other people can be interested in.

So, I save every EntryID in an array and when I import the items, for each one I will check if the entryId is not already in my array.If not, I import the item without problem, else I simply ignore it.
Her is my code (in VB.Net) :
Code
Select All
Dim arrID As New ArrayList(CInt(items.Count + 1))



For i As Int32 = 0 To items.Count - 1

Dim item As MindFusion.Scheduling.Item = ConvertFrom(items.Item(i))

    If Not arrID.Contains(items.Item(i).EntryID) Then

  _schedule.Items.Add(item)

  arrID.Add(items.Item(i).EntryID)

    End If

Next i 



Greg.

  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: double dictionnary key when importing outlook
Reply #5 - Nov 3rd, 2008 at 4:17pm
Print Post  
Good job, Greg  Wink

Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint