Partilhar via


DocumentBase.RequestService Method

Returns an object that implements the Microsoft.Office.Core.IRibbonExtensibility interface in a document-level customization.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Protected Overridable Function RequestService ( _
    serviceGuid As Guid _
) As Object
protected virtual Object RequestService(
    Guid serviceGuid
)

Parameters

  • serviceGuid
    Type: System.Guid

    A Guid that identifies the Microsoft.Office.Core.IRibbonExtensibility interface.

Return Value

Type: System.Object
An object in your document-level customization that implements the Microsoft.Office.Core.IRibbonExtensibility interface.

Remarks

Override this method if you are customizing the Ribbon of the document by creating your own implementation of the Microsoft.Office.Core.IRibbonExtensibility interface or by adding a Ribbon (XML) item to your project.

If you customize the Ribbon by adding a Ribbon (Visual Designer) item to your project, Visual Studio overrides this method for you. For more information, see Ribbon Overview and Ribbon Designer.

If you override this method, check the value of the serviceGuid parameter to determine whether the Microsoft.Office.Core.IRibbonExtensibility interface is being requested, and then return an object that implements the interface. When your document is opened, the Visual Studio Tools for Office runtime calls RequestService, and it sends the return value to Microsoft Office Word. For more information about the Microsoft.Office.Core.IRibbonExtensibility interface, see IRibbonExtensibility Object in the Microsoft Office documentation.

You can alternatively override the CreateRibbonExtensibilityObject method instead of overriding the RequestService method. For more information, see Ribbon XML.

Note

Microsoft.Office.Core.IRibbonExtensibility is one of several interfaces (also named extensibility interfaces) that are provided by Microsoft Office. However, this is the only interface that you can implement in a document-level customization for Word. You can implement other extensibility interfaces in application-level add-ins. For more information, see Customizing UI Features By Using Extensibility Interfaces.

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace