Condividi tramite


Frequently Asked Questions: Declarative Outlook Solution

Applies to: SharePoint Server 2010

In this article
I have a read-only scenario for my declarative solution and Create, Update, and Delete operations do not make much sense. However, the external content type does support these operations. Can I remove them from the BDC model?
How do I refresh the cache in a code action?
What is the acceptable icon format at the various locations? What are the acceptable file formats and expected sizes?
How can I get a custom view to load only for my Task type? By default, it seems to reset to the default view.
Can I completely replace the default Outlook form with an InfoPath form?
Can I associate code with my ribbon in a declarative Outlook solution?
Can I update the publisher of my solution?
In a declarative Outlook solution, how can a custom External Data Part on a layout communicate with other parts on the same layout?

This topic answers some frequently asked questions about intermediate declarative Outlook solutions.

I have a read-only scenario for my declarative solution and Create, Update, and Delete operations do not make much sense. However, the external content type does support these operations. Can I remove them from the BDC model?

Yes, you can remove them from the BDC model. In addition, you can also make the Microsoft Outlook 2010 folder read-only for a better user experience. The following is an example of the OIR.config file that shows how to make a folder read-only.

<OutlookFolder StoreType="Solution" Name="GetBug" FolderDisplayName="Bugs Under PR" NativeType="FolderTasks"  SubscriptionName="816979bb-32c7-489b-861a-3f4b61ec2c9b" FolderName="816979bb-32c7-489b-861a-3f4b61ec2c9b" CanCreate="false" CanUpdate=" false " CanDelete="false">

How do I refresh the cache in a code action?

See the following code example for information on how to trigger a cache refresh based on a certain subscription: Code Snippet: Programmatically Request a Cache Refresh on the Client.

What is the acceptable icon format at the various locations? What are the acceptable file formats and expected sizes?

The requirements for icon file formats and expected sizes are dictated by the Outlook Ribbon extensibility schema.

  • Folder level icon: Can be in .jpg, .bmp, .ico, or .png file format. Must be 16x16 pixels.

  • Item level Icon: Can be in .ico file format only, but be any size.

  • Ribbon button: Can be in .png, .jpg, .bmp, or .ico file format. Can be any size.

How can I get a custom view to load only for my Task type? By default, it seems to reset to the default view.

Specify the name of your custom view in the OIR.config file. The following example shows how to do this.

<OutlookFolder Name="ContosoCustomers" FolderDisplayName="Contoso Customers" ……….>
      <Views<FolderViewDefinition Name="ContosoCustomerViewName" ViewName="ContosoCustomerView" ViewType="TableView" IsDefault="true" ViewFileName="ContosoCustomerView.ovd" />
  </Views>

Can I completely replace the default Outlook form with an InfoPath form?

Yes, you can define a DeclarativeFormRegion + Layout + Action to use a layout with either a Microsoft InfoPath 2010 form or an external data part to replace the default Outlook form.

Replacing the Default Outlook Form with an InfoPath Form

  1. Define a DeclarativeFormRegion.

    <FormRegions i:type="mx:DeclarativeFormRegions" >
      <mx:DeclarativeFormRegion  Type="Replacement" InternalName="CustomerReplaceFormRegion" ShowInspectorComposeMode="true" Name="CustomReplaceFormRegion" Title="MyCustomReplaceFormRegion"/>
    </FormRegions>
    
  2. Define an Action.

    <CodeMethodAction MethodType="ShowRegionLayout" Name="ShowRegionLayoutAction">
      <Parameters>
        <ConstantParameter Name="Param1" ValueType="System.String" Value="IPLayout"/>
        <ConstantParameter Name="Param2" ValueType="System.String" Value=" ArtistReplaceFormRegion" />
      </Parameters>
    
  3. Trigger the Action at when the inspector opens.

      <mx:ContextEventHandlers>
        <mx:ContextActivated ActionName="ShowRegionLayoutAction"/>
      </mx:ContextEventHandlers>
    
  4. Define a Layout.

      <Layouts xmlns="https://schemas.microsoft.com/office/2009/05/BusinessApplications/Manifest/DeclarativeExtensions">
        <Layout Name="IPLayout" LayoutFileName="IPLayout">
        </Layout>
      </Layouts>
    
  5. Create a Layout file to define what to display within the layout.

Can I associate code with my ribbon in a declarative Outlook solution?

Yes. However, by default, in a declarative solution, you can link your code to the OnClick event only, the event that is triggered when you click a ribbon button.

To associate code with the OnClick event

  1. Define the ribbon as shown in the following example Ribbon.xml file.

    <customUI xmlns="https://schemas.microsoft.com/office/2006/01/customui" onLoad="OnLoad" loadImage="GetImage">
      <ribbon>
        <tabs>
          <tab id="tabIssueID" label="Team Review" getVisible="GetVisible" tag="Solution">
            <group id="IssueGroupID" label="Issue Actions" getVisible="GetVisible" tag="Context[TeamIssues.IssueGroupID]">
              <button id="AllIssueButton"
                          size="large"
                          label="All Issues"
                          onAction="OnAction"
                          image="Issue.ico"
                        getEnabled ="GetEnabled"
                        screentip="Display All Existing Issues in Task Pane"
                        tag="Action[TeamIssues.ListIssueAction]"
                      />
    
  2. Define an Action in the Oir.config file.

    <mx:CodeMethodAction MethodType="Custom" Name ="OpenBugRibbonAction" MethodName="OpenBugMethod" QualifiedTypeName="CustomCodeActionNameSpace.CustomCodeActionClassName, CustomCodeActionAssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3c6b236b1e85d97a">
      <mx:Parameters>
        <mx:ExpressionParameter Name="p1" EntityViewInstanceReference="PrimaryEntityNameInContext" Expression="BugID"/>
      </mx:Parameters>
    </mx:CodeMethodAction>
    
  3. Implement a custom code Action.

    using System;
    using System.Text;
    using Microsoft.Office.BusinessApplications.Runtime.OIM;
     
    namespace CustomCodeActionNameSpace
    {
       public class CustomCodeActionCalssName
       {
            public void CustomCodeActionMethod(params object[] parameters)
            {
                //BCS Client Runtime passes in the Current Entity Instance as First parameter by default.
                 IEntityInstance iei = parameters[0] as IEntityInstance;
     
                // Other parameters are passed in based on the configuration within oir.config.
                // Process the Action based on parameters.
            }
        }
    }
    

Note

If you use a custom ribbon manager, your solution will be able to listen to ribbon-related additional events.

Can I update the publisher of my solution?

The Publisher name comes from your certificate. The solution must be signed with a certificate that is issued by a trusted Certification Authority. Due to the limitation of Office development tools for Visual Studio (see KB970682), the certificate of the Certification Authority must be in the Trusted Root Certification Authority certificate store of the client.

In a declarative Outlook solution, how can a custom External Data Part on a layout communicate with other parts on the same layout?

Call this.Parent.Parent to get the layout of the External Data Part and search and compare all the children in that layout to find the one you want. The following code snippet shows how to do this.

WinFormsOBPartBase MyEDP;
ControlCollection allContainersUnderSameLayout = this.Parent.Parent.Controls;
foreach (Control container in allContainersUnderSameLayout)
{
    ControlCollection allEDPsUnderSameContainer = container.Controls;
    foreach (Control edp in allEDPsUnderSameContainer)
    {
        if (edp.Name == "MyEDPName")
        {
            MyEDP = edt as WinFormsOBPartBase;
            break;
        }
    }
}