This illustration shows how to close an opportunity record as won in Microsoft Dynamics CRM 2011 in code in VB.NET using WinOpportunityRequest.
Ok, here is what the code look like!
Dim req As New WinOpportunityRequest() Dim opClose As New OpportunityClose() opClose.OpportunityId = New EntityReference(Opportunity.EntityLogicalName, New Guid("f66a58b1-6847-e111-8d3c-1cc1def1353b")) Dim osvStatus = New OptionSetValue(3) req.Status = osvStatus req.OpportunityClose = opClose Dim resp As WinOpportunityResponse = DirectCast(service.Execute(req), WinOpportunityResponse)
Thats all there is to it!
I hope this helps!