|
|
alvin chan
Posts: 34
Joined: 2019-10-07
|
|
Posted 09 Oct, 2019 05:05:28
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 17493
Joined: 2006-05-11
|
Hello Alvin,
The code contains a condition; delete it. Here's a C# equivalent of what you should do:
if (e.PropertyType == ADXRibbonControlPropertyType.Visible)
{
object context = e.Context;
System.Diagnostics.Debug.WriteLine("!!! " + Microsoft.VisualBasic.Information.TypeName(context));
}
I use the DebugView utility to get the messages sent to Debug.WriteLine(); see http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx.
The code fragment above writes this record:
[18272] !!! Store
Regards from Belarus (GMT+3),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 09 Oct, 2019 05:57:26
|
|
Top
|
|
alvin chan
Posts: 34
Joined: 2019-10-07
|
Andrei
Hello Alvin,
The code contains a condition; delete it. Here's a C# equivalent of what you should do:
if (e.PropertyType == ADXRibbonControlPropertyType.Visible)
{
object context = e.Context;
System.Diagnostics.Debug.WriteLine("!!! " + Microsoft.VisualBasic.Information.TypeName(context));
}
I use the DebugView utility to get the messages sent to Debug.WriteLine(); see http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx.
The code fragment above writes this record:
[18272] !!! Store
This only return me the type of context = store , but I want to get the PST file name or the Pst file path. How can I achieve that ? |
|
Posted 09 Oct, 2019 20:39:57
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 17493
Joined: 2006-05-11
|
Hello Alvin,
Cast the context object to Outlook.Store and analyze its properties.
Regards from Belarus (GMT+3),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 10 Oct, 2019 02:03:07
|
|
Top
|
|
alvin chan
Posts: 34
Joined: 2019-10-07
|
|
Posted 10 Oct, 2019 03:14:36
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 17493
Joined: 2006-05-11
|
Outlook.Store is available since Outlook 2007. You need to switch to using interops of Office 2007 or higher. To do this, replace interops in the Interops folder (see your project folder) with interops from {Add-in Express installation folder}\Redistributables\Interop Assemblies\Office {version}. Then you need to remove old interop references and add new ones. If you switch from ersion-neutral interops (=interops for Office 2000), you may be required to modify some calls that refer to items within a COM collection. Say, you may need to replace SomeCollection.Items(i) with SomeCollection[i]. If I remember this right, the issue only influences C#.
Regards from Belarus (GMT+3),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 10 Oct, 2019 04:34:13
|
|
Top
|
|
alvin chan
Posts: 34
Joined: 2019-10-07
|
|
Posted 10 Oct, 2019 05:34:20
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 17493
Joined: 2006-05-11
|
Hello Alvin,
Put an ADXRibbonCommand components onto the add-in module. Add an invisible Ribbon button to the context menu and check the context object when the PropertyChanging event is raised for you to provide the Visible state of the button (always set it to False): if this is your store, set ADXRibbonCommand.Enabed = false on the commands, otherwise, set ADXRibbonCommand.Enabed = true.
Please check the following sections at https://www.add-in-express.com/docs/net-ribbon-components.php:
- Referring to Built-in Ribbon Controls
- Intercepting Built-in Ribbon Controls
- Disabling Built-in Ribbon Controls
- Updating Ribbon Controls at Run Time
- Determining a Ribbon Control's Context
Regards from Belarus (GMT+3),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 10 Oct, 2019 05:57:26
|
|
Top
|
|
alvin chan
Posts: 34
Joined: 2019-10-07
|
|
Posted 10 Oct, 2019 21:52:29
|
|
Top
|
|
Andrei Smolin
Add-in Express team
Posts: 17493
Joined: 2006-05-11
|
Hello Alvin,
Use IdMso="NewInlineFolder" to control the state of that item in the context menu. Use IdMso="NewFolder" to control the state of the control in the Folder Ribbon tab; set the control's Enabled state in in the FolderSwitch event.
I strongly recommend that you test this code in Outlook 2010 (if you need to support it) where's no "NewInlineFolder" control.
First off, check how this control works in your Outlook 2013+. Then start Outlook 2010: clicking that control shows a New folder dialog.
The point is: since there's no IdMso="NewInlineFolder" in Outlook 2010, you'll receive a Ribbon error message. To see it, you must have the "Show add-in user interface errors" selected; see section "Get Informed about Errors in Ribbon markup" in the PDF file in the folder {Add-in Express}\Docs on your development PC.
To bypass this issue, you need to add some code to the OnRibbonBeforeCreate event of the add-in module. In the event handler, you determine the Office version loading your add-in (e.g. using ADXAddinModule.HostMajorVersion < 15) and delete the ADXRibbonCommand that has IdMso="NewInlineFolder"; find some useful code at https://www.add-in-express.com/forum/read.php?FID=5&TID=15652.
Regards from Belarus (GMT+3),
Andrei Smolin
Add-in Express Team Leader |
|
Posted 11 Oct, 2019 02:29:54
|
|
Top
|
|
Posts 11 - 20 of 26
First | Prev. | 1 2 3 | Next | Last
|