GenerateQuoteFromOpportunity Message (CrmService)
![]() |
[Applies to: Microsoft Dynamics CRM 4.0]
Find the latest SDK documentation: CRM 2015 SDK
| Works for all deployment types | Works online only |
Generates a quote from an opportunity.
The relevant classes are specified in the following table.
| Type | Class |
| Request | GenerateQuoteFromOpportunityRequest |
| Response | GenerateQuoteFromOpportunityResponse |
| Entity | opportunity |
Remarks
To use this message, pass an instance of the GenerateQuoteFromOpportunityRequest class as the request parameter in the Execute method.
To perform this action, the caller must have access rights on the entity instances specified. For a list of required privileges, see GenerateQuoteFromOpportunity Privileges.
Example
The following code example demonstrates how to use the GenerateQuoteFromOpportunity message.
[C#]
// Set up the CRM service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0;
token.OrganizationName = "AdventureWorksCycle";
CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
// Create the request.
GenerateQuoteFromOpportunityRequest generate = new GenerateQuoteFromOpportunityRequest();
// Determines the columns that will be transferred.
// Be aware that using AllColumns may adversely affect
// performance and cause unwanted cascading in subsequent
// updates. A best practice is to retrieve the least amount of
// data required.
generate.ColumnSet = new AllColumns();
// OpportunityId is the GUID of the opportunity generating the quote.
generate.OpportunityId = new Guid("A8228F55-A868-DC11-9F6D-0003FFA48E24");
// Execute the request.
GenerateQuoteFromOpportunityResponse generated = (GenerateQuoteFromOpportunityResponse)service.Execute(generate);
[Visual Basic .NET]
' Set up the CRM service.
Dim token As New CrmAuthenticationToken()
' You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0
token.OrganizationName = "AdventureWorksCycle";
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials
' Create the request.
Dim generate As New GenerateQuoteFromOpportunityRequest()
' Determines the columns that will be transferred
' Be aware that using AllColumns may adversely affect
' performance and cause unwanted cascading in subsequent
' updates. A best practice is to retrieve the least amount of
' data required.
generate.ColumnSet = New AllColumns()
' OpportunityId is the Guid of the opportunity generating the quote
generate.OpportunityId = New Guid("A8228F55-A868-DC11-9F6D-0003FFA48E24")
' Execute the request.
Dim generated As GenerateQuoteFromOpportunityResponse = CType(service.Execute(generate), GenerateQuoteFromOpportunityResponse)
See Also
Concepts
Reference
.gif)