eBusiness Help
Drive low-cost, high quality search traffic to your website
Make the most of your search engine marketing investment
Reach Millions of Job Seekers
Post a job now and save $50.

WebProWorld IT Forum

The best router is......?
I'm considering buying a dsl router, as I'm getting fed-up of the standard ICS networking (i.e. ports get block on my lan even if I use port-forwarding on my firewall)...
Click to read more...

Deleted Files Hanging
Ok, ever since I upgraded my computer a bit, I've been having problems with OE where it gets errors that have nothing to do with my server or ISP. It seems when there are too many e-mail windows open, it crashes & I have to shut everything down...
Click to read more...

dns transfer question
I have my main domain used as nameservers on a shared hosting server. Now, I decided to get it its own server (dedicated) but obviously I will not move the ns1/ns2 to the new server and cause downtime for everyone else.
Click to read more...



Recent Articles

C++ Function Templates
C++ Function templates are those functions which can handle different data types without separate code for each of them.

LM-X License Management Software for C# .NET
X-Formation announced the release of its LM-X license management software for the C# .NET language.

Microsoft CRM Customization: Integration with third party SQL Application/Database
Microsoft CRM - Client Relationship Management package from Microsoft Business Solutions was initially designed to be customizable with Microsoft Visual Studio.Net...

Microsoft CRM Customization secrets – second edition
This article is for advanced Microsoft CRM SDK C# developers. It describes the technique of direct SQL programming, when SDK doesn't have the functionality to do the job.

C# Numerical Library
The IMSL C# Numerical Library is the only mathematical and statistical library written in 100% Microsoft Visual C# .NET for complete compatibility and scalability with the Microsoft .NET Framework.

Microsoft Great Plains Customization and Development
When Great Plains Software was designing and developing Great Plains Dynamics/Dynamics CS+/eEnterprise - it placed several fundamental principles into the system.

Microsoft CRM Programming Secrets – tips for developers
This article is for advanced Microsoft CRM SDK C# developers. It describes the technique of direct SQL programming, when SDK doesn't have the functionality to do the job.

Avoid C# Memory Leaks with Destructor and Dispose
Here are two classes that allocate resources, the first class needs to implement a destructor and Dispose, but the second class doesn't need to. The difference is that the first class allocates resources in the constructor and doesn't clean them up immediately.

01.05.05


Siebel Email Attachments Import - C# And MS Transact SQL Example

By Boris Makushkin

Microsoft CRM - CRM's answer from Microsoft Business Solutions has an aggressive pricing, going down and making it affordable for small companies.

We see cases when Microsoft CRM replaces such traditional CRM systems as Siebel. It is not necessary, that clients decided to replace it themselves - they may be victims of their systems - the example: Great Plains had alliance with Siebel several years ago and we saw multiple clients with Great Plains - Siebel tandem. Now Great Plains integrates with MS CRM.

This article is for programmer, who needs data to be migrated from Siebel or other CRM to MS CRM.

Today's topic is Siebel emails, stored in the files, import into MS CRM database. Each message exists in the form of separate file in the import directory. We will use custom SQL table, created in MS SQL Server 2000:

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CrmAttachImporter]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CrmAttachImporter]
GO

CREATE TABLE [dbo].[CrmAttachImporter] (
     [Id] uniqueidentifier ROWGUIDCOL NOT NULL ,
     [CrmActivityGuid] [varchar] (50) NOT NULL ,
     [MsgFileName] [varchar] (2000) NOT NULL
) ON [PRIMARY]
GO


Comments to this table - its goal is storing MS CRM activity GUID relationship to file name with email attachment (email message), which needs to be attached to the activity. We will store activity GUID in the field CrmActivityGuid and file name in the import directory of the attachment in the MsgFileName field.
Configuration file for our utility will be the following:

<config>
     <connectionString>provider=SQLOLEDB;Initial Catalog=Albaspectrum;Data Source=MSSQL1;User Id=sa;Password=sa;</connectionString>
     <msgFolder>data</msgFolder>
     <tableName>CrmAttachImporter</tableName>
     <activityGuidColumn>CrmActivityGuid</activityGuidColumn>
     <msgFileNameColumn>MsgFileName</msgFileNameColumn>
</config>


Here we described MS SQL Server connection string, the path to messages-files in the file system, table name, which stores the relations Activity GUID and file names, table column names, required for import procedure.

Reach Millions of Job Seekers
Post a job now and save $50.

To control the import process we will use free logging library for .NET: log4net. You can get it here: http://logging.apache.org/log4net/

Let's look at the method of potential attachments catalog scanning:

     public void scanFolder() {
         log = LogManager.GetLogger(typeof(AttachImporter));
         DOMConfigurator.Configure(new FileInfo("log.config"));

         try {
             DirectoryInfo dirInfo = new DirectoryInfo(msgFolder);
             FileInfo[] files = dirInfo.GetFiles();
             Hashtable emails = new Hashtable();

             foreach (FileInfo fileInfo in files) {
                 log.Debug("Analizing file: " + fileInfo.Name);
                
                 Guid activityId = GetActivityIdByFileName(fileInfo.Name);

             if (! activityId.ToString().Equals(new Guid().ToString())) {
             emails.Add(activityId, fileInfo.DirectoryName + @"\" + fileInfo.Name);

             Console.WriteLine("Marked for import: " + fileInfo.Name);
             log.Debug("Marked for import: " + fileInfo.Name);
         }
         else {
         Console.WriteLine("Not found in activity import list: " + fileInfo.Name);
             log.Debug("Not found in activity import list: " + fileInfo.Name);
         }
         }

         ProcessMessages(emails);
         }
         catch (Exception e) {
         Console.WriteLine(e.Message + "\r\n" + e.StackTrace);
         }
     }


Read the Rest of the Article.


About the Author:
Boris Makushkin is senior software developer in Alba Spectrum Technologies – US nation-wide Great Plains, Microsoft CRM customization company, based in Chicago and having locations in multiple states and internationally (www.albaspectrum.com ), he is Unix, SQL, C#.Net, Crystal Reports, Microsoft CRM SDK and Exchange Server SDK developer. You can reach Boris: borism@albaspectrum.com

About CProgrammingTrends
A collection of articles and tutorials designed to help C and C variant programmers in their programming work. C Programming Tutorials and advice

CProgrammingTrends is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagmentNews.com

-- CProgrammingTrends is an iEntry, Inc. publication --
iEntry, Inc. 880 Corporate Drive, Lexington, KY 40503
2005 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal


archives | advertising info | news headlines | free newsletters | comments/feedback | submit article

C Programming Tutorials and advice CProgrammingTrends News Archives About Us Feedback CProgrammingTrends Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact