Replacing Embeded Forms with click on one form.

Add-in Express™ Support Service
That's what is more important than anything else

Replacing Embeded Forms with click on one form.
Embeded Form Adx- Outlook extension 
Vivek Jain




Posts: 19
Joined: 2006-05-26
Hi all,

I am working with Adx Outlook extension to embed my forms in Outlook explorer window. I have succesfully embed a form in explorer which have a button control but I want when i click on button this form should hide and the other form containting results should appear in the same explorer window. I hope you got the problem..

Moreover when i tried to show a win form on the click of this Button it shows me error "Show method is Disabled"??

Can anybody help me out on this ?


Best Regards,
Vivek Jain
Posted 26 May, 2006 09:53:14 Top
Fedor Shihantsov


Add-in Express team


Posts: 1188
Joined: 2005-01-11
Hello Vivek,

>Moreover when i tried to show a win form on the click of this Button it >shows me error "Show method is Disabled"?

ADXOlFormsManager manages form creating and showing itself. That's why the ADXOlForm.Show method doesn't work for you.

To manage form showing in Explorer you use the ADXOlFormsManager.ADXBeforeFolderSwitch event.

Sample:

private void adxOlFormsManager1_ADXBeforeFolderSwitch(...)
{
    adxOlFormsManager1.LockUpdates(); // prevents removing cashed forms
    if (MyCondition)
    {
        adxOlFormsManager1.Items[0].FormClassName = "ADXOlForm1";
    }
    else
    {
        adxOlFormsManager1.Items[0].FormClassName = "ADXOlForm2";
    }
    adxOlFormsManager1.UnlockUpdates();    
}


To initialize the form's data use the ADXOlForm.ADXBeforeFormShow event.

In your case you can use TabControl to change the form's display.
Posted 26 May, 2006 10:52:30 Top
Vivek Jain




Posts: 19
Joined: 2006-05-26
HI Fedor,

Thanks for your Reply. Though i have still some confusion regarding this matter. When i do have a form showing inplace of default exlorer and this form have .net controls such as Button.
Now by on click on this button i want one of the activities should ocuur for diffrent folders..

1)
by Click on this button it should replace the current form with the new form which can contain the results for previous form and again this form replace another so on back and forth. ( This should be for the same explorerlike web pages posted to another page in same explorer.)

2)
when i click the button then in the button click hander i can bind DB data to the .net win form and pop up to the user outside the explorer window.

I hope you got my problem now.

If possible do send me some sort of sample for both the problems so that i can speed up my development.

Thanks for support

Best Regards,
Vivek Jain
Posted 27 May, 2006 04:02:09 Top
Vivek Jain




Posts: 19
Joined: 2006-05-26
Hi Fedor,

I am still awaiting your reply on this ???


Best Regards,
Vivek jain
Posted 29 May, 2006 00:52:32 Top
Fedor Shihantsov


Add-in Express team


Posts: 1188
Joined: 2005-01-11
Hello Vivek,


1)by Click on this button it should replace the current form with the new form which can contain the results for previous form and again this form replace another so on back and forth. ( This should be for the same explorerlike web pages posted to another page in same explorer.)


For resolving this task create a depository (DataContainer) in your AddinModule for data exchange between your forms. And create NextForm method that will change FormClassName.
On clicking the button on your first form save data in AddinModule.
Call NextForm method.
In event ADXBeforeFormShow initialize data for your second form.
See sample below that saves the text from a textbox of the first form and shows it in a textbox of the second form.


//AddinModule
public class AddinModule : AddinExpress.MSO.ADXAddinModule
{
  ...
  private string dataContainer;
  internal string DataContainer
  {
    get{return dataContainer;}
    set{dataContainer = value;}
  }

  internal void NextForm()
  {
    adxOlFormsManager1.Items[0].FormClassName = "ADXOlForm2"; 
    //see note below
  }
}

//Your first form
public class ADXOlForm1 : AddinExpress.OL.ADXOlForm
{
  ...
  private void button1_Click(object sender, EventArgs e)
  {
    (this.AddinModule as YourNameSpace.AddinModule).DataContainer = this.textBox1.Text;
    (this.AddinModule as YourNameSpace.AddinModule).NextForm();
  }
}

//Your second form
public class ADXOlForm2 : AddinExpress.OL.ADXOlForm
{
  ...
  private void ADXOlForm2_ADXBeforeFormShow()
  {
    this.textBox1.Text = (this.AddinModule as YourNameSpace.AddinModule).DataContainer;
  }
}



Note: In the current version, whenever you change any ADXOlFormsCollectionItem’s properties, ADXOlFormsManager removes all forms, creates a new form for the current folder. If you need to change more than one property, you should use LockUpdates() and UnlockUpdates() methods of ADXOlFormsManager. I.e. you call LockUpdates(), change some properties of your choice, call UnlockUpdates and change one more property (this will refresh data). We plan to replace this behavior in future versions.



2) when i click the button then in the button click hander i can bind DB data to the .net win form and pop up to the user outside the explorer window.


In this case you can in the Click event handler:
1. Create a new form.
2. Fill it with data.
3. Show it in modal mode.
4. Disconnect from DB (naturally after form closing).



I am still awaiting your reply on this ???



I copied the following text from http://www.add-in-express.com/forum/
===
Please note our working time is from 08:00 to 18:00 GMT (Monday - Friday) and our public holidays may or may not coincide with yours.
===

Regards,
Fedor Shihantsov
Posted 29 May, 2006 05:35:17 Top
Vivek Jain




Posts: 19
Joined: 2006-05-26
HI Fedor,

Thanks for your reply...

I just coded the way you tell me But it dosent work

Note: i have added a formmanager and creat two adx forms then assign form adxform to task folder by adding a collection item in formmanager. But i didnt add the second adx form in form manager collecion as i dont need to bind any other folder with my form. Is any problem with this ???


Here my Code....

///// My addin Code which is as "LetTry"

using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
using Outlook = Microsoft.Office.Interop.Outlook;

namespace LetTry
{
/// <summary>
/// Add-in Express Add-in Module
/// </summary>
[GuidAttribute("E59CD591-E2F7-4207-8AC5-91329A402D3C"), ProgId("LetTry.AddinModule")]
public class AddinModule : AddinExpress.MSO.ADXAddinModule
{
public AddinModule()
{
InitializeComponent();
}

private AddinExpress.OL.ADXOlFormsManager adxOlFormsManager1;
private AddinExpress.OL.ADXOlFormsCollectionItem adxOlFormsCollectionItem1;

#region Component Designer generated code
/// <summary>
/// Required by designer
/// </summary>
private System.ComponentModel.IContainer components;

/// <summary>
/// Required by designer support - do not modify
/// the following method
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.adxOlFormsManager1 = new AddinExpress.OL.ADXOlFormsManager(this.components);
this.adxOlFormsCollectionItem1 = new AddinExpress.OL.ADXOlFormsCollectionItem(this.components);
//
// adxOlFormsManager1
//
this.adxOlFormsManager1.Items.Add(this.adxOlFormsCollectionItem1);
this.adxOlFormsManager1.SetOwner(this);
//
// adxOlFormsCollectionItem1
//
this.adxOlFormsCollectionItem1.ExplorerItemTypes = AddinExpress.OL.ADXOlExplorerItemTypes.olTaskItem;
this.adxOlFormsCollectionItem1.ExplorerLayout = AddinExpress.OL.ADXOlExplorerLayout.WebViewPane;
this.adxOlFormsCollectionItem1.FolderName = "Tasks";
this.adxOlFormsCollectionItem1.FormClassName = "frmFqLogin";
//
// AddinModule
//
this.AddinName = "LetTry";
this.ShimProgID = "LetTryShim.Proxy";
this.SupportedApps = AddinExpress.MSO.ADXOfficeHostApp.ohaOutlook;

}
#endregion

#region ADX automatic code

// Required by Add-in Express - do not modify
// the methods within this region

public override System.ComponentModel.IContainer GetContainer()
{
if (components == null)
components = new System.ComponentModel.Container();
return components;
}

[ComRegisterFunctionAttribute]
public static void AddinRegister(Type t)
{
AddinExpress.MSO.ADXAddinModule.ADXRegister(t);
}

[ComUnregisterFunctionAttribute]
public static void AddinUnregister(Type t)
{
AddinExpress.MSO.ADXAddinModule.ADXUnregister(t);
}

public override void UninstallControls()
{
base.UninstallControls();
}

#endregion

public Outlook._Application OutlookApp
{
get
{
return (HostApplication as Outlook._Application);
}
}

internal void Nextform()
{
adxOlFormsManager1.Items[0].FormClassName = "frmFqAfterLogin";
}
internal void Nextform2()
{
adxOlFormsManager1.Items[0].FormClassName = "frmFqLogin";
}

}
}


///////////////// here is My first Form Code

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace LetTry
{
/// <summary>
/// Summary description for frmFqLogin.
/// </summary>
public class frmFqLogin : AddinExpress.OL.ADXOlForm
{
private Button button1;
private System.ComponentModel.IContainer components = null;

public frmFqLogin()
{
// This call is required by the Windows Form Designer.
InitializeComponent();

// TODO: Add any initialization after the InitializeComponent call

}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(228, 81);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 26);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// frmFqLogin
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(744, 795);
this.Controls.Add(this.button1);
this.Name = "frmFqLogin";
this.Text = "frmFqLogin";
this.ResumeLayout(false);

}
#endregion

private void button1_Click(object sender, EventArgs e)
{
LetTry.AddinModule LetAddin = new LetTry.AddinModule();
LetAddin.Nextform();
}
}
}

////// Here Is my Second Form Code

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace LetTry
{
/// <summary>
/// Summary description for frmFqAfterLogin.
/// </summary>
public class frmFqAfterLogin : AddinExpress.OL.ADXOlForm
{
private Button button1;
private Label label1;
private System.ComponentModel.IContainer components = null;

public frmFqAfterLogin()
{
// This call is required by the Windows Form Designer.
InitializeComponent();

// TODO: Add any initialization after the InitializeComponent call

}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(120, 87);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 32);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(64, 28);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(70, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Second Form";
//
// frmFqAfterLogin
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(300, 300);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.Name = "frmFqAfterLogin";
this.Text = "frmFqAfterLogin";
this.Load += new System.EventHandler(this.frmFqAfterLogin_Load);
this.ResumeLayout(false);
this.PerformLayout();

}
#endregion

private void frmFqAfterLogin_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
LetTry.AddinModule LetTryAddin = new LetTry.AddinModule();
LetTryAddin.Nextform2();
}
}
}



Note :

I do have Some other Queries as well like

1) Where Should i place the code to create the folder as i have to assign that folder only to the foldername property in formmanager

2) I want to change the explorer view for this newly created folder only not the all having the same type which this folder have. I mean if i create a folder of mail type and i place form manager properties as

ItemType mail
Folder Class "AnyformClass name"
Foldername "Newly Created Folder only"

Then It should apply only the folder not all but in my case it is applied to all even after i mentioned the folder name.....


Thanks i have done the Form open task outside the explorer which i wasn't earlier.

Fedor i am hoping your early reply as i have to prepare some Proof of concepts so that we can go ahead with this project....

Best Regards,
Vivek Jain


Posted 29 May, 2006 07:48:43 Top
Fedor Shihantsov


Add-in Express team


Posts: 1188
Joined: 2005-01-11
Vivek,

At first, change

private void button1_Click(object sender, EventArgs e) 
{ 
  LetTry.AddinModule LetAddin = new LetTry.AddinModule(); 
  LetAddin.Nextform(); 
} 

to

private void button1_Click(object sender, EventArgs e) 
{
  //An ADXOlForm has the AddinModule property that return reference to
  //ADXAddinModule, which contains ADXOlFormsManager.
  (this.AddinModule as LetTry.AddinModule).NextForm(); 
} 


Apply this change to the second form too.



1) Where Should i place the code to create the folder as i have to assign that folder only to the foldername property in formmanager


I don’t quite understand your “to create the folder”.
Presuming that you create folders yourself, then after folder creation you should use the following code: ADXOlFormsManager.Items[0].FolderName = FullFoldeName;

//FullFoldeName sample - “Personal Folders\Inbox\My Folder1”


2) I want to change the explorer view for this newly created folder only not the all having the same type which this folder have. I mean if i create a folder of mail type and i place form manager properties as


AIUI you have ADX Extensions version 1.0.893. This version does not include LockUpdates() and UnlockUpdates() methods of ADXOlFormsManager, which were introduced in build 895.

We are to release new public version today, where you will find these methods.

I will create a sample that will demonstrate how to show a separate form for a folder when for other folder of this type there will be another form showing. Wait for tomorrow, please.
Posted 29 May, 2006 10:30:51 Top
Vivek Jain




Posts: 19
Joined: 2006-05-26
Hi Fedor,

Many Thanks for your Reply!! Wow This is working now um now able to switch the forms in the same explorer!! This is seriously great Stuff

Well I just left two issues now
***************************** First ************************************
A)

"To create folder" means

1) Programatically creating folder(s) under existing folders like personal,inbox etc.

2) Wanted to know if we could create the same using Add-in express. In a normal scenario we used Outlook.CreateFolder method in OnStartupComplete Routine.

3) We would like to know the way to crete the folder(s) on start up of the add-in in outlook with Add-in Express.

4) Now In FormManager I will have some Forms which will be the WebView URL's of the folder(s) which are not created at design time and which will be created at runtime as i mentiond at the start up of my add-in!!

Hope you Undersatnd the Problem So, I would like to know that where i can place the code to create the folder(s) Programatically.

***************************** Second ************************************

B) The same one which you have asked me to wait till tommrow. Not a problem.....

Again Many Thanks for your support.

Best Regards,
Vivek Jain



Posted 29 May, 2006 11:15:43 Top
Eugene Starostin


ADX Team
Add-in Express team


Posts: 430
Joined: 2004-04-05
Hi Vivek,

Points 1, 2 and 3.
Add-in Express allows you to use Office PIAs or late binding. Simply access Outlook.Application via the HostApplication property or the OutlookApp property of the add-in module.

Point 4.
You can use the AddinStartupComplete event of the add-in module.
Posted 30 May, 2006 03:46:38 Top
Vivek Jain




Posts: 19
Joined: 2006-05-26
HI Eugene,

I am Using follwing code to create folders in Outlook with Add-in Express but when i register the add-in it prompts me the error that Object Refence Not set to an instance of object. When I debug i came to know that when I assign the this.OutlookApp to the Outlook.Application object and try to use it is null?? why as this.outlookapp should return the outlook.application object to be used later on.. Might be um doin some mistake so pasting my code here for your evaluation. I have put the comment inside the code where is my function and where um getiing error while debugging.


using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
using Outlook = Microsoft.Office.Interop.Outlook;
using System.Xml;
using System.Reflection;
using LetTry;

namespace LetTry
{
/// <summary>
/// Add-in Express Add-in Module
/// </summary>
[GuidAttribute("E59CD591-E2F7-4207-8AC5-91329A402D3C"), ProgId("LetTry.AddinModule")]
public class AddinModule : AddinExpress.MSO.ADXAddinModule
{
private Outlook._Application app; // My Variable Of type Outlook.application
private Outlook.NameSpace _mapiNamespace; // My variable of type namespace.

public AddinModule()
{

InitializeComponent();
CreateCRMTodayFolders(); /// My Method To Create Folder
}

private AddinExpress.OL.ADXOlFormsManager adxOlFormsManager1;
private AddinExpress.OL.ADXOlFormsCollectionItem adxOlFormsCollectionItem1;

#region Component Designer generated code
/// <summary>
/// Required by designer
/// </summary>
private System.ComponentModel.IContainer components;

/// <summary>
/// Required by designer support - do not modify
/// the following method
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.adxOlFormsManager1 = new AddinExpress.OL.ADXOlFormsManager(this.components);
this.adxOlFormsCollectionItem1 = new AddinExpress.OL.ADXOlFormsCollectionItem(this.components);
//
// adxOlFormsManager1
//
this.adxOlFormsManager1.Items.Add(this.adxOlFormsCollectionItem1);
this.adxOlFormsManager1.SetOwner(this);
//
// adxOlFormsCollectionItem1
//
this.adxOlFormsCollectionItem1.ExplorerItemTypes = AddinExpress.OL.ADXOlExplorerItemTypes.olTaskItem;
this.adxOlFormsCollectionItem1.ExplorerLayout = AddinExpress.OL.ADXOlExplorerLayout.WebViewPane;
this.adxOlFormsCollectionItem1.FolderName = "Tasks";
this.adxOlFormsCollectionItem1.FormClassName = "frmFqLogin";
//
// AddinModule
//
this.AddinName = "LetTry";
this.ShimProgID = "LetTryShim.Proxy";
this.SupportedApps = AddinExpress.MSO.ADXOfficeHostApp.ohaOutlook;

}
#endregion

#region ADX automatic code

// Required by Add-in Express - do not modify
// the methods within this region

public override System.ComponentModel.IContainer GetContainer()
{
if (components == null)
components = new System.ComponentModel.Container();
return components;
}

[ComRegisterFunctionAttribute]
public static void AddinRegister(Type t)
{
AddinExpress.MSO.ADXAddinModule.ADXRegister(t);
}

[ComUnregisterFunctionAttribute]
public static void AddinUnregister(Type t)
{
AddinExpress.MSO.ADXAddinModule.ADXUnregister(t);
}

public override void UninstallControls()
{
base.UninstallControls();
}

#endregion

public Outlook._Application OutlookApp
{
get
{
return (HostApplication as Outlook._Application);
}
}

private void CreateCRMTodayFolders()
{

app = this.OutlookApp; // The App Object Remain Null even After This Assignment

_mapiNamespace = app.GetNamespace("MAPI"); // And This gives me error when i try to access the app object.

Outlook.MAPIFolder rootFolder = (Outlook.MAPIFolder)_mapiNamespace.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox).Parent;

string url;
int Count;

XmlDocument xmlObj = new XmlDocument();

xmlObj.Load(Resource1.URL);
url = xmlObj.DocumentElement.SelectSingleNode("Path").InnerText;

Outlook.MAPIFolder crmFolder = Folder.CreateFolder(rootFolder, "FinalQuadrant", Outlook.OlDefaultFolders.olFolderInbox);
crmFolder.WebViewURL = url;
crmFolder.WebViewOn = true;

Outlook.MAPIFolder accountsFolder = Folder.CreateFolder(crmFolder, "Suitecase",Outlook.OlDefaultFolders.olFolderInbox);

Outlook.MAPIFolder Bookings = Folder.CreateFolder(accountsFolder, "Bookings",Outlook.OlDefaultFolders.olFolderInbox);
Outlook.MAPIFolder List = Folder.CreateFolder(Bookings, "List",Outlook.OlDefaultFolders.olFolderInbox);
Outlook.MAPIFolder Queue = Folder.CreateFolder(Bookings, "PaymentQueue",Outlook.OlDefaultFolders.olFolderTasks);
Outlook.MAPIFolder Clients = Folder.CreateFolder(accountsFolder, "Client",Outlook.OlDefaultFolders.olFolderInbox);
Outlook.MAPIFolder Contacts = Folder.CreateFolder(Clients, "Contacts",Outlook.OlDefaultFolders.olFolderContacts);

Count = xmlObj.DocumentElement.SelectSingleNode("Contacts").SelectNodes("Contact").Count;
for (int i = 0; i < Count; i++)
{
Outlook.ContactItem newContact = (Outlook.ContactItem)Contacts.Items.Add(Outlook.OlItemType.olContactItem);
newContact.FirstName = xmlObj.DocumentElement.SelectSingleNode("Contacts").SelectNodes("Contact").Item(i).SelectSingleNode("FirstName").InnerText;
newContact.LastName = xmlObj.DocumentElement.SelectSingleNode("Contacts").SelectNodes("Contact").Item(i).SelectSingleNode("LastName").InnerText;
newContact.JobTitle = xmlObj.DocumentElement.SelectSingleNode("Contacts").SelectNodes("Contact").Item(i).SelectSingleNode("JobTitle").InnerText;
newContact.BusinessTelephoneNumber = xmlObj.DocumentElement.SelectSingleNode("Contacts").SelectNodes("Contact").Item(i).SelectSingleNode("BusinessTelephoneNumber").InnerText;
newContact.BusinessAddress = xmlObj.DocumentElement.SelectSingleNode("Contacts").SelectNodes("Contact").Item(i).SelectSingleNode("BusinessAddress").InnerText;
newContact.Save();
}

Count = xmlObj.DocumentElement.SelectSingleNode("Queues").SelectNodes("Queue").Count;
for (int i = 0; i < Count; i++)
{
Outlook.TaskItem newtask = (Outlook.TaskItem)Queue.Items.Add(Outlook.OlItemType.olTaskItem);
newtask.Body = xmlObj.DocumentElement.SelectSingleNode("Queues").SelectNodes("Queue").Item(i).SelectSingleNode("Body").InnerText;
newtask.Subject = xmlObj.DocumentElement.SelectSingleNode("Queues").SelectNodes("Queue").Item(i).SelectSingleNode("Subject").InnerText;
newtask.Contacts = xmlObj.DocumentElement.SelectSingleNode("Queues").SelectNodes("Queue").Item(i).SelectSingleNode("Contact").InnerText;
newtask.Save();
}

Count = xmlObj.DocumentElement.SelectSingleNode("Lists").SelectNodes("List").Count;
for (int i = 0; i < Count; i++)
{
//Outlook.MailItem newBooking = (Outlook.MailItem)List.Items.Add(Outlook.OlItemType.olMailItem);
//newBooking.Subject = xmlObj.DocumentElement.SelectSingleNode("Lists").SelectNodes("List").Item(i).SelectSingleNode("Subject").InnerText;
ItemAdapter outlookItem = ItemAdapter.FromObject(List.Items.Add(Outlook.OlItemType.olPostItem));
SetOutlookItemProperty(outlookItem, xmlObj.DocumentElement.SelectSingleNode("Lists").SelectNodes("List").Item(i).SelectSingleNode("Stage").InnerText, "SalesStage");
//SetOutlookItemProperty(outlookItem,Val,"Subject");
outlookItem.SetProperty("Subject",xmlObj.DocumentElement.SelectSingleNode("Lists").SelectNodes("List").Item(i).SelectSingleNode("Subject").InnerText);
//outlookItem.SetProperty("SalesStage",xmlObj.DocumentElement.SelectSingleNode("Lists").SelectNodes("List").Item(i).SelectSingleNode("Stage").InnerText);
outlookItem.Save();
}



xmlObj.Load(Resource1.OpportunityView);

Outlook.View ListView = List.Views["CurrentBookings"];

if (ListView == null)
ListView = List.Views.Add("Bookings",Outlook.OlViewType.olTableView,Outlook.OlViewSaveOption.olViewSaveOptionThisFolderEveryone);

ListView.XML = xmlObj.OuterXml;

ListView.Save();
ListView.Apply();
}


private static void SetOutlookItemProperty(ItemAdapter outlookItem, string Val, string Type)
{
Outlook.UserProperty uProp = outlookItem.UserProperties[Type];
if (uProp == null)
{
uProp = outlookItem.UserProperties.Add(Type, Outlook.OlUserPropertyType.olText, true, Missing.Value);
uProp.Value = Val;
}
else
{
outlookItem.SetProperty(Type, Val);
}
}
}
}


Please suggest me Where I am doin wrong and moreover i can not see any AddinStartupComplete event of the add-in module in the Method drop down. Please also tell me where it is.


Best Regards,
Vivek Jain
Posted 30 May, 2006 04:49:03 Top