Multiple FormRegions, the GUID, and ThisAddIn.RequestService()

Status
Not open for further replies.
C

cGtlbGxleQ

My setup:

Windows XP, Microsoft Visual Studio 2005, using VSTO SE, developing in C#.

Question background:

With regard to a single FormRegion, Microsoft instructs the following:

Replace the definition of the FormRegionHookup class with the following

code. This code implements the

Microsoft.Office.Interop.Outlook.FormRegionStartup interface, and applies the

ComVisibleAttribute, GuidAttribute, ProgIdAttribute, and

ClassInterfaceAttribute attributes to the FormRegionHookup class.

[ComVisible(true),

Guid("88F7BFBE-7666-4a0c-BCFD-2740E6625E04"),

ProgId("FormRegionAddIn.FormRegionHookup"),

ClassInterface(ClassInterfaceType.AutoDual)]

public class FormRegionHookup : Outlook.FormRegionStartup

Question:

If I have 2 FormRegions that I have created and I have 2 classes where each

class extends the Outlook.FormRegionStartup interface.

1. Do I use the same GUID for both classes?

Guid("88F7BFBE-7666-4a0c-BCFD-2740E6625E04")

My gut answer to this question is "Yes", but I just want to make sure.
 
Worse yet, my "ThisAddIn" class only has 1 "protected override object

RequestService(Guid serviceGuid)" method.

We are taught to write:

if (serviceGuid ==

typeof(Microsoft.Office.Interop.Outlook.FormRegionStartup).GUID)

{

// Instantiate your form here.

myForm = new myFormRegionHookup();

myForm2 = new myForm2RegionHookup();

// Then return your form to the caller. Yeah, but which form???

return ???;

}

"pkelley" wrote:


> My setup:
> Windows XP, Microsoft Visual Studio 2005, using VSTO SE, developing in C#.

> Question background:
> With regard to a single FormRegion, Microsoft instructs the following:

> Replace the definition of the FormRegionHookup class with the following
> code. This code implements the
> Microsoft.Office.Interop.Outlook.FormRegionStartup interface, and applies the
> ComVisibleAttribute, GuidAttribute, ProgIdAttribute, and
> ClassInterfaceAttribute attributes to the FormRegionHookup class.

> [ComVisible(true),
> Guid("88F7BFBE-7666-4a0c-BCFD-2740E6625E04"),
> ProgId("FormRegionAddIn.FormRegionHookup"),
> ClassInterface(ClassInterfaceType.AutoDual)]
> public class FormRegionHookup : Outlook.FormRegionStartup

> Question:
> If I have 2 FormRegions that I have created and I have 2 classes where each
> class extends the Outlook.FormRegionStartup interface.

> 1. Do I use the same GUID for both classes?

> Guid("88F7BFBE-7666-4a0c-BCFD-2740E6625E04")

> My gut answer to this question is "Yes", but I just want to make sure.
 
Solved these problems:

The FormRegion you return from "RequestService()" will define the

"FormRegionName" used in the call to "GetFormRegionStorage()".

Since I have 2 FormRegions, and since "RequestService()" gets called once

for each FormRegion in my AddIn, I just keep track of which FormRegion I

return from "RequestService()" using a boolean variable, like this:

// Return the "m_form1" on the first pass and the

// "m_form2" on the next pass.

if (!m_form1Returned)

{

m_form1Returned = true;

return m_form1;

}

else

{

return m_form2;

}

"pkelley" wrote:


> Worse yet, my "ThisAddIn" class only has 1 "protected override object
> RequestService(Guid serviceGuid)" method.

> We are taught to write:

> if (serviceGuid ==
> typeof(Microsoft.Office.Interop.Outlook.FormRegionStartup).GUID)
> {
> // Instantiate your form here.
> myForm = new myFormRegionHookup();
> myForm2 = new myForm2RegionHookup();

> // Then return your form to the caller. Yeah, but which form???
> return ???;
> }

> "pkelley" wrote:
>
> > My setup:
> > Windows XP, Microsoft Visual Studio 2005, using VSTO SE, developing in C#.
> > Question background:
> > With regard to a single FormRegion, Microsoft instructs the following:
> > Replace the definition of the FormRegionHookup class with the following
> > code. This code implements the
> > Microsoft.Office.Interop.Outlook.FormRegionStartup interface, and applies the
> > ComVisibleAttribute, GuidAttribute, ProgIdAttribute, and
> > ClassInterfaceAttribute attributes to the FormRegionHookup class.
> > [ComVisible(true),
> > Guid("88F7BFBE-7666-4a0c-BCFD-2740E6625E04"),
> > ProgId("FormRegionAddIn.FormRegionHookup"),
> > ClassInterface(ClassInterfaceType.AutoDual)]
> > public class FormRegionHookup : Outlook.FormRegionStartup
> > Question:
> > If I have 2 FormRegions that I have created and I have 2 classes where each
> > class extends the Outlook.FormRegionStartup interface.
> > 1. Do I use the same GUID for both classes?
> > Guid("88F7BFBE-7666-4a0c-BCFD-2740E6625E04")
> > My gut answer to this question is "Yes", but I just want to make sure.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
chummy Open multiple Hyperlinks to download files Outlook VBA and Custom Forms 3
R Select Multiple Graphic Objects Using Outlook 0
Hornblower409 Automatically or Manually Backup Multiple Versions of VbaProject.OTM Outlook VBA and Custom Forms 1
B Modify VBA to create a RULE to block multiple messages Outlook VBA and Custom Forms 0
C Outlook 365 Multiple different Signatures on Shared Mailbox Using Outlook 0
R Advise on using multiple instances of network files based on customers Outlook VBA and Custom Forms 8
D multiple email accounts - why do I have to choose the "from" account address?? Using Outlook 2
J Outlook Rules VBA Run a Script - Multiple Rules Outlook VBA and Custom Forms 0
C How to search for items in Outbox with multiple accounts? Using Outlook 20
K How to share multiple calendar items Using Outlook 1
K Multiple copies of task being created Using Outlook 2
S Auto forward for multiple emails Outlook VBA and Custom Forms 0
K Multiple Rules on Single Email Using Outlook 2
Cathy Rhone gmail listed multiple times Using Outlook 3
H Synchronize contacts and calendars across multiple devices Using Outlook 0
V Outlook 2016 Multiple recurring tasks getting created Using Outlook 0
K can't get custom form to update multiple contacts using VBA Outlook VBA and Custom Forms 3
Globalforester ItemAdd Macro - multiple emails Outlook VBA and Custom Forms 3
J Multiple calendars Using Outlook 0
C Multiple emails Using Outlook 8
C Outlook with Office365 - search across account, by date rate, in multiple folders - how? Using Outlook 2
E Asking user to select multiple options in a list in an email Outlook VBA and Custom Forms 0
A Multiple signatures Using Outlook 2
O Outlook tasks - Add text column with multiple lines Using Outlook 3
R How to get the Items object of the default mailbox of a specific account in a multiple account Outlook? Outlook VBA and Custom Forms 0
I Saving attachments from multiple emails and updating file name Outlook VBA and Custom Forms 0
L Multiple Inboxes Using Outlook 3
RBLampert Accessing Outlook accounts from multiple computers Using Outlook 8
Martull Forced signature when multiple accounts exist Outlook VBA and Custom Forms 4
T Outlook 2010 Correct way to map multiple contact fields Using Outlook 4
Y Open and Save Hyperlink Files in multiple emails Outlook VBA and Custom Forms 9
O Multiple email accounts - hesitate to create a new profile Using Outlook 3
papa.deblanc Multiple Instances Using Outlook 6
V Multiple Calendars in Outlook To-Do Bar; Office 365 Using Outlook 3
A Add multiple servers "on behalf of" email to "safe senders" list. Using Outlook 1
M possible to search Outlook for multiple email addresses at once? Using Outlook 1
C Macro to add multiple recipients to message Outlook VBA and Custom Forms 3
D [TOOL] QuickModules to sort emails very quickly to multiple folders Outlook VBA and Custom Forms 1
A Multiple Outlook Invites Received by One Person Using Outlook 4
N Selecting multiple calendar items Using Outlook 4
F Sharepoint tasks from multiple accounts in To-Do List Using Outlook 8
N Multiple instances of Outlook on Start Menu Using Outlook 2
D Edit Subject (Multiple Accounts) Outlook VBA and Custom Forms 5
B VBA Macro for assigning multiple Categories to an email in my Inbox Outlook VBA and Custom Forms 1
L Need to import multiple Outlook files to Office 365 Account Using Outlook 4
B Deleting multiple accounts Using Outlook 1
M Dialog called up multiple times when saving emails from macro Outlook VBA and Custom Forms 2
M Multiple spurious empty folders appear in archive files Using Outlook 3
G Bcc help - Preventing multiple forwards from a bcc'd distribution group Using Outlook 1
J Outlook Rules - Changing auto-submit address in multiple rules, according to rule name Outlook VBA and Custom Forms 0

Similar threads

Back
Top