[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Manual Outlook synching - how to

Posted on 2009-04-28
3
Medium Priority
?
293 Views
Last Modified: 2012-05-06
I have to synch all the users calendars, including notes and tasks, into a database.
I'm figuring I'll have to synch to a server installation of Outlook 2007, then take that to the database.
However, auto synching does not include all fields we need and I don't have an Exchange server is that's necessary.
How do I access/extract the fields from Outlook 2007?
0
Comment
Question by:dcass
  • 2
3 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 24265473
Hi, dcass.

You don't have to sync to a server installation of Outlook and then to a database.  You can sync directly to the database.  However you choose to do it, it's going to take some programming effort.  Outlook does not have a built-in synchronization routine for this, so you'll have to design your own.  Here's an example of a very simple routine I wrote for another question a few years ago: http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_21450551.html
0
 

Author Comment

by:dcass
ID: 24266380
This works but it only outputs the last task (to Excel) over and over.  If I can get how to index this, I have it.  The comments didn't work.

                  Outlook.Application o1App = new Outlook.ApplicationClass();
                  Outlook.NameSpace olNs = o1App.GetNamespace("MAPI");
                  Outlook.MAPIFolder oFolder = olNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks);
                  Console.Write(oFolder.Name);
                  Outlook.MAPIFolder oTasks = olNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks);
                  Excel.Application excelApp = new Excel.Application();
                  string myPath = @"C:/Tasks.xls";
                  //excelApp.Workbooks.Open(myPath);
                  excelApp.Workbooks.Open(myPath,0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "",true, false, 0, true, false, false);
                  int rowIndex = 1; int colIndex = 1;

                  //excelApp.Cells[rowIndex, colIndex] = "First";
                  excelApp.Visible = true;

                  
                  int ctr = oTasks.Items.Count;
                  Outlook.Items oItems = oTasks.Items;
                  //string str = oTasks.Items.
                  string sFilter;
                  sFilter = "[Priority] = 'Normal'";
                  Outlook._TaskItem oTask = (Outlook._TaskItem) oItems.Find(sFilter);
                  for (int i=1;i< ctr; i++)                        
                  {
                        rowIndex = i;
                        //excelApp.Cells[rowIndex, colIndex] = oTasks[i];
                        //Outlook.TaskItem oTaskItm = oTasks.Views.Application.CopyFile(myPath);
//Outlook._TaskItem oTask = (Outlook._TaskItem) oItems.Add( "IPM.Task" ); oTask.Subject = "My Subject";
                        //Outlook._TaskItem oTaskItm = (Outlook._TaskItem) oItems.Add( "IPM.Task" ); oTask.Subject;
                        Outlook._TaskItem oSubject = (Outlook._TaskItem) oItems[1];
                        //Outlook._TaskItem oSubject = oTask.Subject;
                        excelApp.Cells[rowIndex, colIndex] = oTask.Subject.ToString();
                        
                  }
0
 

Accepted Solution

by:
dcass earned 0 total points
ID: 24271823
Solved the problem for future users - attached.  May not be pretty and I'm still working on it, but it works.
using System;
using Excel;
using Outlook;
 
namespace ConsoleApplication1
{
	class Class1
	{
		[STAThread]
		static void Main(string[] args)
		{
			Outlook.Application o1App = new Outlook.ApplicationClass();
			Outlook.NameSpace olNs = o1App.GetNamespace("MAPI");
			Outlook.MAPIFolder oFolder = olNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks);
			Console.Write(oFolder.Name);
			Outlook.MAPIFolder oTasks = olNs.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks);
			Excel.Application excelApp = new Excel.Application();
			string myPath = @"C:/Tasks.xls";
			excelApp.Workbooks.Open(myPath,0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "",true, false, 0, true, false, false);
			int rowIndex = 1; int colIndex = 1;
			excelApp.Visible = true;
 
			//string sFilter;
			//sFilter = "[Priority] = 'Normal'";
			//Outlook._TaskItem oTask = (Outlook._TaskItem) oItems.Find(sFilter);
			int ctr = oTasks.Items.Count;
			Outlook.Items oItms = oTasks.Items;
 
			Outlook.Application outlookApp = new Outlook.Application();
 
			for (int i=1;i< ctr; i++)				
			{
				rowIndex = i;
				excelApp.Cells[rowIndex, colIndex] = oItms[i];
				Outlook._TaskItem oTask = (Outlook._TaskItem) oItms[i];
				excelApp.Cells[rowIndex, 2] = Convert.ToDateTime(oTask.DueDate);
			}
				
		}
	}
}

Open in new window

0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question