Import/Sync Contacts from SQL Server to Outlook - c#

Essentially I have a SQL Server (2008) database that contains contact information (among other things), and would like to provide the ability to view these contacts in Outlook. Outlook 2003 must be supported at minimum. The Outlook clients are connected to Exchange, so having the contacts available in Exchange (and then viewable via Outlook) would work as well.
The sync or import would be one-way, from the database to Outlook/Exchange, so the contacts in Outlook/Exchange could be read-only (or changes could be discarded during import).
I think best case would be that Outlook/Exchange reads from the database in real time, so that if changes are made to the database they are immediately visible when they are accessed. However, if this is not possible (I suspect it's not), the user could either click a button, the sync could happen periodically, or it could happen on Outlook start-up.
Not necessarily looking for a complete solution, just thoughts on an approach to take, and any resources with basic code samples.

There are several technologies you can use:
Exchange 2010 Web Services. Use your favourite SOAP/XML toolkit (like WCF) to manipulate exchange objects, including Contacts. See Working with Contacts for code samples.
Exchange 2003/2007 Collaboration Data Objects (COM), see an example on Creating a Contact in the Exchange Store or this for 2007
WebDAV (HTTP requests) for Exchange 2003/2007 see Creating a Contact in the Exchange Store (WebDAV) or this for 2007
In addition there are client technologies around the Office object model and Outlook, but those would add contacts to individual Outlook address books, not to the central exchange store (ie. not available to the entire org).

Try GeniusConnect

You could look into Outlook 2003 VBA to do this. Many years ago I used (misused?) Outlook VBA to read some data from a database. I don't know how far VBA would get you (and each user would have to install the VBA code on their Outlook client), but it's a place to start looking, anyway.

While looking for an answer to a similar issue I found this aswel.
It is a fully written working example in C# with the following features:
Import Contacts to Outlook from Database.
Export Contacts from Outlook to Database.
Synchronizing Contacts between Outlook and Database.
Three more code examples:
Outlook Contacts Sync SQL
Moving Data to Outlook from SQL
Coupling Outlook to SQL Server
And here another website with more general information on how to connect the both of them.

Related

Synchronize my asp.net application with Google calendar, outlook calendar and other main stream calendar services

I have to create an application that needs to synchronize with Google, outlook or any other popular calendar services. It need to be two way meaning updates and events from google/outlook calendar needs to be visible and editable in my application and vice versa.
I have been searching for a while in hope to find something like Email services that can be synchronized using Imap and Smtp servers.
I found out that .ics file can be used to export and import calendar data. But in my case it need to be real time synchronization from both sides.
Are there any APIs or libraries i can use? Or any other way to do it?
Any suggestion is welcome.
Thank you.
The de facto way to synchronize calendars is a CalDAV server, which reads and writes events to a local database and exposes the event details through the ICS format, wrapped in CalDAV messages.
Various clients have differing levels of support for the protocol and its extensions.
Apple iCalelndar, Mozilla Thunderbird with Lightning and Microsoft Outlook with some proprietary plugin can talk CalDAV, but each have their specific annoyances. iCalendar will refuse to remove conflicts, Lightning will get stuck with authentication issues and stop updating and the Outlook plugins, well ... suck.
One Outlook plugin in particular was designed by a developer (literally 20 tabs in the settings screen), didn't implement base64 properly (we had to pad its messages at the server) and refused to do anything useful when a debugger was active on the machine it ran on.
But that was the state of things like five years ago, and I haven't touched the subject since. I think we settled on using a Google Calendar and provide a one-way sync through ICS files.

Importing Data into Outlook.com

I'm currently tasked with importing a huge number of Emails from proprietary mail system into an Outlook.com account (yes, the web service not the desktop app).
Due to the proprietary nature of the source system and the fact that all emails require custom pre-processing prior to importing them into Outlook.com, any commercial service is not an option. Importing the data into a local Outlook database and then export it to Outlook.com is probably not an option either since this is meant to run server side.
What would be my best option to implement the actual import step that preserves the actual email timestamps as they were when the mail was originally received?
This is not for a large number of accounts but this is how you do it for a single account. I would recommend reaching out to Microsoft for support especially if you are a paying customer that needs to import this data.
According to Outlook.com IMAP is not supported yet. Outlook.com does support ActiveSync. I'm not sure which proprietary mail system you are using but it appears that only method would be to setup ActiveSync on the desktop (Outlook) then add a second account (proprietary mail system) via IMAP, then to drag-drop the contents between the two accounts. This is a common method to migrate email data.
Secondly, you can login into your Outlook account and set it to import 3rd party email. Here is an article showing how to do that, Move Your Mail to Outlook article.

Connect to Access database that links to SharePoint lists using C#

I have an window application in which I am trying to connect to a Access Database that has a table linking to a SharePoint list using OLEDB in C#
My attempts:
Use Access 2007 format for the database and Microsoft.ACE.OLEDB.12.0 for the ConnectionString
Everything works perfectly okay, until there's one guy reports the error "The 'Microsolf.ACE.OLEDB.12.0' provider is not registered on the local machine"
Check: he has Windows x86, Access 2003, but not 2007, and does not have "2007 Office System Driver: Data Connectivity Components" installed
Really troublesome and time-consuming to get these installed (Company's machine)
Use Access 2003 format for the database and Microsoft.ACE.OLEDB.12.0 for the ConnectionString
Same error as the above. So I guess it is the "Microsoft.ACE.OLEDB.12.0" that causes the problem. But I don't know how to get it fixed.
Using Access 2003 format for the database and Microsoft.Jet.OLEDB.4.0 for the ConnectionString
Error on my machine: "Could not find installable ISAM" (I don't have Access 2003, but only Access 2007)
His machine: works perfectly
Please help me point out what I can do to fix this problem without having every one update their Office version to 2007 or having the application check people's Office version before connecting to the Access database.
Thanks in advance.
You as a general rule cannot link to something else that is linking to the data!
If the data sitting on SharePoint why attempt to use Access here? You could never link to an Access database that has linked tables to SQL server, so this makes even LESS sense to hit SharePoint this way.
And worse I don't believe that SharePoint supports oleDB linked tables. While Access does support oldDB, and you trying to connect o Access you want to keep in mind that ADO been rather depreciated. While the Access data engine continues to receive all kinds of new features like complex data support (multi-value SharePoint columns), and things like a new-off line disconnected mode we have for Access 2010 with SharePoint, these features are certainly not appropoate to consume by attempting to link to linked tables. As noted, because Access is linked to SQL server or SharePoint in the past, no one would suggest you now attempt to link to the Access file which then in turn must make web service calls to SharePoint (BTW, Access makes web services calls to SharePoint to consume that data).
Since the data is on SharePoint, why are you attempting to hit some file based "thing" sitting on a local hard drive? Why don't you just hit the SharePoint site as a web service? There are tons of web services and ways to consume SharePoint lists in .net. I see little reason and advantage to dump all that fantastic technology and ability in .net to consume web services and then attempting to read some file based Access database that has links to SharePoint. The only way such a setup makes sense is if your development is primary in Access, and that then DOES make sense to dump the use of c# here and just use Access.
My suggestion is thus to consume the SharePoint lists in c#, and by-pass the Access data engine here.

How do I access Outlook mails with ASP.NET?

I'm trying to write an asp.net (using c#) app that accesses my Outlook mailbox and display the messages. I searched on google but couldn't find useful info, any help is appreciated?
You must be aware of the fact that outlook is running on user local machine, and your ASP.NET application is running on some server and there is no way that your server side ASP.NET code can use Outlook local data.
AFAIK only way to do something like that would be creating outlook addin that will export all mails to ASP.NET application
If you are using Exchange then you can use Exchange Web Services to read emails.
Please see here
Be very careful that you do not attempt to access Outlook on the server side by using the Automation interfaces. All of the Microsoft Office desktop applications are written to be run by an interactive user in a process with a message pump, with all synchronization happening via the UI. When you run them in a multi-threaded environment like ASP.NET, horrible things will happen. If you're lucky, the application will simply crash.
If you're not lucky, you can suffer from data corruption, random crashes in unrelated code, and all the other things that happen when an application corrupts memory.
You may also violate your license if the people accessing the Office application through your web site are not individually licensed to use the application on their desktop.
You can't connect to Outlook via C# (ASP.NET), but you can connect to your mailserver via POP3/IMAP to read the mail.
IMAP Client library using C#

C# / Exchange EMail Client

I need to create a very simple c# Windows Service to listen for, and process email wth special subject lines. I already have the code that process these emails working well. For ease of development, I just packaged the code in an "Outlook Addin" on my own machine, running under my own email account. Works great.
Now that it's working, I need to move this to the server. I have a special email account setup on the Exchange Server for this purpose. I really don't want Outlook running on the server. Is there some other way to login to this email account and listen for email from my Windows Service without using the Outlook client?
Thanks!
It sounds like your code is closely tied to Outlook, so you may have to change your approach for the server. I faced exactly the same problem last year and considered the following options :
CDO (not supported by Microsoft with .NET due to some strangeness when running in process)
WebDAV for Exchange 2003
Web Services for Exchange 2007 (great example in the link)
You also need to ask yourself - do you actually need your program to check the mail server? I couldnt use any of the above options so ended up having one of the mail admins set up an exchange rule that dropped the emails/attachments into a special folder on the server. I could then process the files at my leisure. Worked extremely well and much easier to maintain than directly interrogating the mail server through code.
If your exchange admin has enabled it you can use IMAP or POP3 to connect to the server.
You can also use MAPI to connect as well.
You can find a number of libraries (free and otherwise) for doing all three.
I have had good experience with MailBee IMAP but there are definitely free alternatives if you only need to do some simple functionality.

Categories