Microsoft CRM Version 1.2 SDK

Welcome to the Microsoft® Business Solutions CRM Version 1.2 Software Development Kit (SDK). This SDK contains a wealth of resources, including code samples, that are designed to help you build powerful vertical applications using the Microsoft CRM platform. For a brief introduction to the Microsoft CRM architecture and its key components, see Overview.

The Microsoft CRM SDK also includes documentation that provides a wide range of instructive and practical information. In addition to a comprehensive class library reference, the documentation offers conceptual overviews, integration details, database schemas, and sample code. To help you locate the information that interests you the most, the following sections list the main areas of the documentation.

Before you can use this SDK effectively, it is very important that you have Microsoft CRM installed. To ensure a successful installation, follow the detailed procedures in the Readme and Microsoft Business Solutions CRM Implementation Guide. These documents, located on the Documentation CD, describe the essential steps to setting up the environment prior to installing Microsoft CRM.

Changes in Microsoft CRM Version 1.2

The following table provides a summary of the changes in Microsoft CRM version 1.2 that are relevant to this SDK.

Description of change | Affected SDK topics
New assemblies for SDK | Class Library
Updates in data migration | Data Migration

Release History

Release Date
SDK Version 1.0, November 2003

Initial release for Microsoft CRM Version 1.2

The Microsoft CRM SDK Documentation

Getting Started

Offers strategies to help you use this SDK quickly and efficiently.

Overview

Summarizes the fundamentals of Microsoft CRM.

Security Model

Describes the details of the Microsoft CRM security model.

Object Model

Describes the details of the objects used in the Microsoft CRM SDK.

Application Integration

Describes the methods that you can use to add your own menus and toolbars to the Microsoft CRM application. This section also describes how to open Microsoft CRM forms by using a URL.

Data Migration

Describes the structure of the Common Data Format (CDF) database used to prepare data for migration to Microsoft CRM using the Microsoft CRM Data Migration Framework.

How To

Provides sample code that shows you how to perform some common tasks by using the Microsoft CRM class library.

Reference

Provides complete reference documentation for the Microsoft CRM SDK, including the following main sections:

  • Class Library

    Supplies syntax, code examples, and related information for each class contained in the Microsoft CRM SDK.

  • Error Codes

    Contains a complete list of error return codes.

  • Schemas

    Documents the Microsoft CRM metabase schema, the Fetch XML schema, and the ColumnSet schema.

  • Workflow Reference

    Provides detailed information on how to build custom workflows.

  • Glossary

    Provides concise definitions for key Microsoft CRM terms.

Additional Information

You can find additional information about Microsoft CRM on the PartnerSource Web site located at

www.microsoft.com/BusinessSolutions/PartnerSource/default.mspx.

You can also find additional information in the following documents:

Microsoft CRM Getting Started Guide

Provides information to guide you through the initial steps when you begin using Microsoft CRM.

Microsoft Business Solutions CRM Implementation Guide

Provides the step-by-step information you need to implement Microsoft CRM successfully in your organization.

Microsoft CRM Deployment Manager Help

Provides information about how to use Deployment Manager to customize your database schema, manage Microsoft CRM servers, and manage Microsoft CRM licenses.

Microsoft CRM Data Migration Framework Guide

Provides step-by-step instructions for planning data migration and for using the tools in the Data Migration Framework to migrate your data to Microsoft CRM.

Web Sites

Microsoft® .NET Framework

Find information about designing, developing, debugging, testing, deploying, and managing applications created with Microsoft .NET Framework. This Web site is located at msdn.microsoft.com/netframework/.

XML Document Object Model

Find out how to work with in-memory XML documents. This information is needed for using many of the methods found in the Microsoft CRM application programming interface (API). This Web site is located at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

Active Directory

Find out about Active Directory®, the Microsoft® Windows® operating system directory service that is designed for distributed computing environments. This Web site is located at www.microsoft.com/windows2000/technologies/directory/ad/default.asp.

© 2003 Microsoft Corporation. All rights reserved.


Getting Started

Microsoft® Business Solutions CRM is a Microsoft® .NET-connected product suite that provides sales force automation and customer service for mid-size businesses. Microsoft CRM enables developers to build best-of-breed, distributed, customer relationship management (CRM) applications using the core Microsoft CRM functionality. Developers can use a SOAP-based platform API to access the core business and service objects. Also, Microsoft CRM provides a security model that supports both object and role-based security. Microsoft CRM is a metadata-driven product. It includes a schema for Microsoft CRM objects that covers common and business-specific data.

Document Conventions describes the typographic conventions used in the SDK.

Overview is broken down into the following topics:

  • Platform Overview
  • Security Overview
  • Business and Organization Structures
  • The Object Model
  • Database Overview
  • Workflow
  • Application Programming Interfaces


Document Conventions

The following table shows the typographic conventions used in the Microsoft CRM SDK documentation.

Convention Description Example
Monospace Indicates source code, code examples, input to the command line, application output, and code lines embedded in text, variables, and code elements.
public class
Bold Indicates most predefined programming elements, including namespaces, classes, delegates, objects, interfaces, methods, functions, macros, structures, constructors, properties, events, enumerations, fields, operators, statements, directives, data types, keywords, exceptions, non-HTML attributes, and configuration tags, as well as registry keys, sub-keys, and values. It also indicates the following HTML elements: attributes, directives, keywords, values, and headers.

In addition, it indicates required user input (including command-line options) that must be entered exactly as shown.

const struct CUserAuth &Caller,
BSTR Account,
Italic Indicates placeholders, most often method or function parameters and HTML placeholders; these placeholders represent information that must be supplied by the implementation or by the user.

For command-line input, it indicates parameter values.

 context parameter


Overview

This section contains an overview of the architecture that composes Microsoft CRM. Microsoft CRM is a Microsoft .NET-connected CRM product suite that provides sales force automation and customer service for mid-sized businesses.

In general, there are three physical layers within the Microsoft CRM architectural "stack," as illustrated in the following figure. These are the client, application, and server layers. The server layer contains what you use in the Microsoft Platform SDK. Microsoft CRM relies on Active Directory®, the Microsoft® Windows® operating system directory service, and on two external Microsoft applications to perform additional processing. Active Directory is used for identifying security principals, roles, and groups within the product. Microsoft Exchange 2000 Server and Microsoft Exchange Server 2003 are used for sending and receiving e-mail messages. Microsoft SQL Server™ 2000 is used as the data storage mechanism.

Microsoft CRM Version 1.2 Architecture

Microsoft CRM Version 1.2 Architecture

© 2003 Microsoft Corporation. All rights reserved.


Platform Overview

The platform is the heart of the Microsoft CRM system. When you use the Microsoft CRM SDK, you are building on top of this system. The Microsoft CRM platform supports smaller deployments and can scale for Application Server Providers (ASP) models as well. The focus of the security model is protection of the platform from unauthorized access across the Web. The main platform components are:

  • The database
  • System services (workflow)
  • The object model
  • A query processor that supports the object model
  • Secured ad-hoc queries that use an Extensible Markup Language (XML) fetch statement to protect the physical database

When you develop an application using the Microsoft CRM platform, you use messages formatted as XML strings to communicate with the underlying platform layer. You use SOAP for communication between an application and the platform.

The platform is responsible for creating domain-specific objects. In the Microsoft CRM space, these objects include contact, lead, opportunity, account, and business unit, among others. The goal of the platform is to implement the service-specific rules by manipulating and combining the underlying domain objects.

The platform does not impose business-specific logic. This layer imposes only generic domain constraints. It contains the building blocks for an application, but by itself is nothing more than a collection of related objects. However, the interaction between those objects within the domain can be assumed to implement more extensible logic such as the quote-to-order-to-invoice processing and pricing logic.

The platform does more than just contain the Microsoft CRM business objects. It is responsible for controlling access to objects through security, for controlling access to the database, and for raising events for workflow processes and custom business logic implementations. Think of the platform layer as providing all of the "hard" plumbing work necessary to implement a complete Microsoft CRM application. The platform layer provides for both inbound and outbound e-mail processing through the CRM-Exchange E-mail Router. The platform also implements a replaceable pricing module for opportunities, quotes, orders, and sales invoices.

Data Tier

The data tier is the lowest level of the platform and consists of a database (loosely speaking) and a well-defined data access layer. The data management tier in Microsoft CRM supports Microsoft SQL Server 2000 as the primary data store. The data access layer provides a consistent programming interface for the service developer, which abstracts platform business logic from the underlying data source. The platform tier is the only direct consumer of this layer.

The data store hides the data access mechanism and exposes a common interface, in this case the Transact-SQL programming language. Microsoft CRM internally uses an object-based data management layer to shield the platform code from the data access code. Just as it's not possible for an application developer to directly access the database, it's also not possible for a platform developer. This object-based data management construct has been exposed to the application developer in the form of the CRMQuery class along with the <fetch> query language.

Access the Platform: An Example

The following steps illustrate how the system handles a sample request from an application:

  1. A user submits a request to create a new account.
  2. The request goes through the platform API that passes the user credentials.
  3. The platform API calls the object model that verifies whether the user is authenticated.
  4. The object model then requests the logical properties of an object that is accessible by the caller.
  5. A request is then made to the query builder for a Transact-SQL query to be built.
  6. The query builder gets the request, uses the metadata to build a physical query, and then returns the Transact-SQL statement to the caller.
  7. The query is then passed to the data access layer, which returns a property bag to the caller.
  8. The data is then serialized to XML back to the API for consumption by the application.

The following sections provide more information to help you understand this example.


Security Overview

The Microsoft Business Solutions CRM Software Development Kit (SDK) provides you with a security model that protects data integrity and privacy, and also supports efficient data access, teamwork, and collaboration. The Microsoft CRM security model was designed with the following goals:

  • Support data sharing, so that users can access objects for collaborative effort.
  • Prevent users from accessing objects that have not been shared with them.
  • Categorize types of users in order to define roles and restrict access based on those roles.

The first two goals relate to object security; the last goal relates to role-based security.

The object security model focuses on the primary business objects, namely Leads, Opportunities, Contacts, Accounts, Competitors, Products, Sales Literature, Quotes, Orders, Invoices, Contracts, and Incidents (Cases), which form the core of a sales force automation/customer service solution.

The role-based security model provides a means to group a set of privileges together to describe the access rights for a user.

The Microsoft CRM security model is both robust and flexible. As a result, the SDK offers different security rights that you can combine together to define the overall security rights users have within your custom Microsoft CRM application.

The SDK also includes a set of predefined security roles, each of which is a set of security rights aggregated to make user security management easier. Each application deployment can also define its own roles to meet the needs of different users.

For in-depth explanation of the security model, refer to Microsoft CRM Security.


Business and Organization Structures

Microsoft CRM uses a very simple, but powerful, organizational structure for the construction of arbitrarily complex business hierarchies. Each installation can have multiple organizations. However, every action performed by a user is confined to the user's own organization. Organizations are lightweight entities which provide a common location from which to locate other business units. Business units are not strictly hierarchical in nature; however, they may be parented only by a single business unit.

Note The Microsoft CRM application does not support multiple organizations.

There are three primary entities within the organizational structure, not including the organization itself. These are users, teams, and business units. Users represent real people who are members of an Active Directory domain; these are the people who use the Microsoft CRM application. Teams are arbitrary groups of users created and defined by a user in an organization. Business units are the structural units of an organization, as defined by a user in the organization; they are the primary container entity within the organizational hierarchy. It's the business unit structure that determines and defines the concepts of Basic, Local, Deep, and Global access, which will be covered in the sections Microsoft CRM Security and Access Levels. The following diagram is an example of a Microsoft CRM business unit structure for an organization.

The organization contains six business units in a simple hierarchy. The business units directly below the organization are unrelated in any apparent structural way except for the fact that they all belong to the same organizational structure.

The two business units labeled Department A1 and Department A2 are child business units of Business A. These two business units have a special relationship with regard to users parented to Business A – they serve up business objects to users within Business A who have "Deep" access. Note that it's not possible to construct matrix organizations within the Microsoft CRM organizational structure.

Within this structure, users can be created from the users who are members of the Active Directory domains. Users within Microsoft CRM must be 'parented' to a business unit and cannot be parented to the organization object itself. In the previous diagram, this means that users can be located at any node except the top-level node labeled Organization.


The Object Model

The object model is your view to the objects used in Microsoft CRM. It leverages a set of metadata components that create SQL statements on the fly, providing you with the ability to support create, retrieve, update, and delete methods with very little coding. The object model sits below the APIs. It supports Microsoft CRM requirements for passing workflow and back-office events to other external systems.

In Microsoft CRM, the platform consists of several high-level areas.

Sales force automation

This provides salespeople with access to critical customer information and tools that enhance their ability to sell products and services and manage their time effectively. Sales force automation encompasses the following:

  • Opportunity and lead management. Finding and managing leads and opportunities.
  • Contact management. Creating and keeping customers by tracking personal information.
  • Account management. Creating and keeping customers by tracking information about the customers' business.
  • Sales processes. Converting a lead to an opportunity and then to a closed sale.
  • Competitor and referral libraries. Tracking where leads come from and who competes for the customer.
  • Sales force management. Managing sales quotas and commissions.
  • Quote generation. Making it easy for the salesperson to get the right price to the customer quickly.
  • Sales order and invoice generation. Managing quotes, orders, and invoices.
  • Activity management. Handling e-mail, phone calls, fax transmittals, letters, tasks, and appointments.

Product catalog management

This allows business units to manage a full-featured product catalog, including support for complex pricing models.

Customer service and support

This enables the enterprise to effectively and efficiently address customer questions, problems, or issues. Although customer satisfaction is the primary goal, many organizations are seeking to increase revenues and also provide customer service through cross-selling to existing customers. Customer service and support encompasses the following:

  • Knowledge Base. Helping customers find answers to their questions.
  • Customer care. Managing pre-sale and post-sale customer interactions.
  • Case Management. Handling customer interactions.
  • Contract Management. Managing contracts with customers.
  • Queue Management. Handling work queues dealing with customer issues.

For more details, refer to Microsoft CRM Object Model.


Database Overview

Microsoft CRM is a metadata-driven product. This means that the vast majority of its work is focused on abstracting itself away from the implementation details that so often cause problems with upgrades and extensibility. The metadata layer in essence abstracts the underlying data storage details, such as schema and data access, from the higher level constructs of domain-logic implementation and user interface. The word metadata literally means "descriptive information about the elements of a set of data." The metadata can be thought of as a description of the underlying data structures that controls how the application (platform and user interface) operates and displays itself.

The platform uses the metadata to buffer itself from changes to the underlying database structures. If a table definition changes (for example, when columns are added or removed), the platform code continues to operate without any performance or degradation. This means that Microsoft CRM can be altered significantly to meet a particular business or vertical definition and still operate without interruption.

The Microsoft CRM platform isn't the only consumer of the metadata. The application layer uses the rules inherent in the metadata to present the exact user experience offered by vertical solutions and customizations. These rules include attribute type definitions, entity definitions, and attribute context rules. Attribute metadata describes the underlying type structure of a given attribute, including the fundamental data type (such as string, integer, or date) and the information that effectively limits the attribute's type definition (such as its size and range values). Attribute context rules describe when and how a given attribute can be used. For example, some attributes are write-once, such as order numbers. These attributes shouldn't be changed after they have been created because changing them causes ripple effects throughout the business data. Other attributes are always read-only and are supplied by the platform itself. The metadata captures all of these rules about context, but it also captures business-defined rules, such as business-recommended and business-required attributes.


Workflow

The workflow subsystem's goal is to process system events and run processes.

The workflow system consists of:

  • A set of SOAP APIs. See CRMProcess and CRMProcessController classes.
  • The Workflow Service (a Microsoft Windows service) that responds to events, schedules events, and runs processes. The Workflow Service is available in the Services utility in Windows Administrative Tools. This service is installed during Microsoft CRM Server installation and is configured to be started automatically.
  • The Workflow Manager tool that provides a graphical user interface for creating processes.
  • The Workflow Monitor tool that provides a graphical user interface for viewing process instances.

For more information about the workflow tools, please see the online help provided in each tool.

See also Workflow and Rule Management.


Business Logic Extensions

Microsoft CRM exposes a very simple extension mechanism for implementing custom platform-based business logic — a COM-based "callout" model. With this model, application developers are not limited to creating custom business logic only in the application or through workflow processes; they can also construct business logic that runs in the context of a call, but in response to a particular event.

This extension mechanism exposes a callout interface that is based on a simple pipeline model. The pipeline model allows for both "pre" and "post" interceptions for the most basic data persistence operations. The platform metadata stores information about each entity. This information about entities can be used to track the list of callout handlers, the class names, and whether a given handler is required for an action. For example, the account object can have several registered handlers. These handlers are stored in call order, which is determined by priority. When an action occurs (for example, CRMAccount::Create), the platform checks the metadata for registered event handlers. This information is stored in the metadata and is cached on the platform server. If a handler is registered for notification, the platform creates the handler object and calls the correct handler method, passing the original XML document.

Note This version of the Microsoft CRM SDK supports only post-callouts.

For detailed information about using post-callouts, see the MSDN Library article "Business Logic Extensions to Microsoft CRM: Post-Callouts," (msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmbscrm/html/mbs_crmpostcallouts.asp?frame=true).


Application Programming Interfaces

The platform application programming interfaces (APIs) are your view to the logical Microsoft CRM system. The APIs are relatively flat and require knowledge of the Microsoft CRM object model.

For a complete listing of APIs, refer to the Microsoft CRM Reference section.


Supported Customizations

There are two areas in Microsoft® Business Solutions CRM where you can perform customizations. Each area includes a specific level of support and the ability to be upgraded, as shown in the following table.

Area | Support level | Upgrade level
Customizations using Microsoft CRM tools | Fully supported | Fully upgradeable
Customizations using the Microsoft CRM SDK (This includes application and Microsoft Outlook® integration, post-callouts, and onChange events.) | Fully supported | Mostly upgradeable

Note Fully supported means that developer support can provide assistance for customizations and that application support can assist customers running those modifications.

All other customizations are unsupported and might cause problems during updates and upgrades to Microsoft CRM. For more information, see Unsupported Customizations.

Customizations using Microsoft CRM tools

There are many tools included with Microsoft CRM that you can use to customize it. All tools and customizations created and developed by using these tools are fully supported and can be upgraded. These types of modifications are the easiest to implement and maintain.

The following is a list of tools that can be used to produce fully supported customizations:

  • Deployment Manager (Schema Manager, Entity Mapper, Import/Export Customization)
  • Workflow Manager
  • Form Editor
  • View Editor
  • Preview Editor
  • Template Editors (E-mail, Knowledge Base, Contract)

Customizations using the Microsoft CRM SDK

The Microsoft CRM SDK, white papers published on the MSDN Web site (www.msdn.microsoft.com), and information released by the SDK Support Team are included in the area of customizations using the Microsoft CRM SDK. The specific actions and their levels of supportability and upgradeability are as follows:

  • Microsoft CRM SDK. The Microsoft CRM SDK is fully supported and upgradeable.

    Important This does not mean that a particular entity's attributes will remain the same in future versions.

  • onChange event. The ability to add custom logic to forms through the onChange event for drop-down lists (picklists) is supported and upgradeable. However, the code inside the event and the way the event interacts with the Document Object Model (DOM) might not be supported. The structure of the forms and the elements on the forms could change in future releases.
  • ISV.config file. The ability to link Microsoft CRM with third-party applications or actions by using the ISV.config file is fully supported and upgradeable. Calling back to the opening window by using window.opener or other methods is supported but is not upgradeable. The DOM could change in future releases, and any code you write that uses the DOM could be broken by applying updates or upgrading to a newer version.
  • White papers and samples. Topics covered in white papers or samples published on MSDN in the Microsoft CRM SDK section are supported and upgradeable. This includes the ability to perform post-callouts, which was not part of the original release of the Microsoft CRM SDK.


Unsupported Customizations

Modifications to Microsoft CRM that are made without using either the Microsoft CRM SDK or Microsoft CRM tools are not supported and are not preserved during updates or upgrades of Microsoft CRM. In addition, unsupported modifications might cause problems when you update or upgrade Microsoft CRM. In general, you can avoid update and upgrade issues by not modifying any file that you did not create yourself. (The ISV.config file in the wwwroot\_Resources directory is the only exception to this rule.)

The following is a list of the types of actions that are not supported and could cause upgrade problems:

  • Modifications to any .apsx, .css, .htm, .js, .xml, .jpg, or .gif files in the wwwroot directories of the Microsoft CRM application or Microsoft CRM tools. During upgrades and updates, these files are not checked for modifications and might be overwritten.
  • Modifications to the physical schema of the database. This includes any actions performed against the database without going through Schema Manager. Modifying tables, indexes, stored procedures, or views in the database is not supported. Adding tables, indexes, stored procedures, or views to the database also is not supported because of referential integrity or upgrade issues. Any time you make changes to the database without using Schema Manager, you run a great risk of problems occurring during updates and upgrades.
  • Referencing any dynamic-link libraries (DLL) other than Microsoft.Crm.Platform.Proxy.dll or Microsoft.Crm.Platform.Types.dll. At this time, only the Microsoft.Crm.Platform.Proxy and Microsoft.Crm.Platform.Types namespaces and their documented application programming interfaces (APIs) are supported. All other installed files can change at any time, and their use is not supported.
  • Modifications to any of the Microsoft CRM custom forms in Microsoft Outlook® or to .pst files are not supported and cannot be upgraded.


Microsoft CRM Security Model

Microsoft CRM provides you with a security model that both protects data integrity and privacy and also supports efficient data access and collaboration. The Microsoft CRM security model is designed to support recommended security best practices. The goals of the model are as follows:

  • To provide users with access only to the appropriate levels of information required to do their jobs.
  • To categorize types of users in order to define roles and restrict access based on those roles.
  • To support data sharing, so that users can be granted access to objects that they do not own for a specified collaborative effort.
  • To prevent a user's access to objects the user does not own or share.

The first two goals relate to role-based security; the last two goals relate to object-based security.

Role-based security in Microsoft CRM focuses on grouping a set of privileges together which describe the responsibilities (or tasks that can be performed) for a user. Microsoft CRM includes a set of predefined security roles, each of which is a set of user rights aggregated to make user security management easier. Each application deployment can also define its own roles to meet the needs of different users.

Object-based security in Microsoft CRM focuses on access rights to the primary business objects, namely Leads, Opportunities, Contacts, Accounts, Competitors, Products, Sales Literature, Quotes, Orders, Invoices, Contracts, and Incidents (Cases), which form the core of a sales force automation or customer service solution.

You combine role-based security and object security to define the overall security rights users have within your custom Microsoft CRM application.

The following sections provide the details of the main concepts in the Microsoft CRM security model:

  • Security Principals
  • Role-Based Security
  • Object-Based Security
  • Licenses
  • Security Dependencies
  • Active Directory
  • Security Best Practices


Security Principals

Microsoft CRM defines a security principal as an entity that can effectively "own" or "access" an object within the system. There are two primary types of security principals within Microsoft CRM: users and teams. The CSecurityPrincipal class is used in many APIs, such as GrantAccess and Assign. With few exceptions, all entities that can be owned by users can also be owned by teams.

Note The Microsoft CRM application does not support assignment of objects to teams.

Teams

A team is a group of users. A team does not have any roles assigned to it, nor does it have any privileges. However, you can grant a team access to objects in the same manner in which you grant a user access to objects, and teams can even own objects. The actual access to objects shared within a team for a user who is a member of the team is determined by that user's privileges.

For example: Two users, Joe and Sara, are members of the same team. Joe is a Salesperson and, thus, has the privilege to read opportunities. Sara is a Customer Service Representative and does not have that privilege. If an opportunity is shared with the team, Joe will have access to it and Sara will not.


Role-Based Security

The fundamental concept in role-based security is that privileges are assigned to defined categories of users (known as roles) rather than to individual users. When a user is assigned to one of these roles, he or she is assigned the set of privileges associated with that role. A user who is not assigned to a role does not have any privileges.

In Microsoft CRM, a role describes a defined set of responsibilities (or tasks to perform) within the organization, for example, a sales representative. Each role is assigned a set of privileges that are relevant to the performance of the tasks defined for that role. All users must be assigned to one of these predefined roles.

A privilege authorizes the user to perform a specific action on a specific object type. Privileges apply to an entire class of objects, rather than individual instances of objects. For example, if a user does not have the privilege to read accounts, then any attempt by that user to read an account will fail. Each privilege can have up to four access levels: Basic, Local, Deep, and Global.

In Microsoft CRM, privileges are predefined on a system-wide basis during setup. There are over 200 different privileges in Microsoft CRM. You can see the complete list of privileges available in the Microsoft CRM application in Appendix A.

Microsoft CRM uses privileges as the core of the underlying security check. Privileges are "built in" to the product and are used throughout the application and platform layers. It's not possible to add or remove privileges, nor is it possible to change how privileges are used to grant access to certain functionality, but it is possible to construct new roles from the existing privilege set.

The following table describes the classes used for managing role-based security.

Class | Description
CBizPrivilege | Contains methods to manage business privileges
SecRole | Contains methods to manage security roles

For more information about dependencies between privileges, see Security Dependencies.

For information about security best practices, see Security Best Practices.


Roles

The Microsoft CRM SDK ships with a set of eight predefined roles that reflect common user roles with access levels defined to match the security best-practice goal of providing access to the minimum amount of business data required for the job. With these roles you can quickly deploy a Microsoft CRM system without the overhead of defining your own roles. However, you can create custom roles using the predefined roles as a template, or you can start from scratch to define an entirely new set of roles.

The following table lists the predefined roles included in the SDK.

Role | Description
CEO-Business Manager | A user who manages the organization at the corporate business level.
Vice President of Sales | A user who manages a business unit at the child business unit level.
Sales Manager | A user who manages sales activities at the business unit or team level.
Salesperson | A salesperson at any level.
Customer Service Representative | A customer service representative (CSR) at any level.
CSR Manager | A user who manages customer service activities at the local or team level.
Marketing Professional | A user engaged in marketing activities at any level.
System Administrator | A user who defines and implements the process at any level. This role has the full set of privileges. Limit the number of people who are assigned this role. Do not delete or modify the System Administrator role because you will not be able to reinstate it and could therefore lock yourself out of the system.

Each of the defined roles is associated with a set of privileges that determines the user's access to information within the company. For example, the Salesperson role might contain privileges like prvReadAccount with Basic depth and prvWriteAccount with Basic depth, whereas, the Sales Manager role might contain privileges like prvReadAccount with Local depth or prvAssignContact with Local depth.

For a complete list of the privileges defined for these roles, see Appendix A.

A user can be assigned zero, one, or many roles. A user can simultaneously have any number of roles. For example, a user can have the Sales Manager role in addition to being a Customer Service Representative, in which case that user gets all the privileges of both roles.

Roles are configurable within Microsoft CRM and may be modified or even removed as necessary to fit your business needs. (However, the System Administrator role should never be deleted.) The roles you create for your business unit are inherited by all of the business units in the hierarchy.

Privileges cannot be modified at the user level, but they can be modified at the role level. For example, John is given a Salesperson role, which requires him to accept all leads assigned to him. However, the administrator wants John to be able to reassign leads assigned to him. As a result, the administrator either needs to modify the Salesperson role to allow this or create a new role that incorporates this specific privilege and add John to this role. Creating a new role is the recommended option unless you think it essential that all users who are assigned the Salesperson role now have this additional privilege.


Best practices

Follow these guidelines to help you protect your business data:

  • Stringently limit the number of people assigned the System Administrator role. Never remove this role.
  • Create roles according to the security best-practice goal of providing access to the minimum amount of business data required for the task.
  • Assign roles so that users have only the minimum access levels and access rights required for them to do their jobs.
  • If a user needs additional access to objects, create a new role with the specific privileges that are required for the user to accomplish the additional tasks and then add the user to the new role. A user's rights are the union of all the roles to which they have been assigned. Don't grant the original role privileges that are needed only by one or a few members in the organization with that role.


Access levels

The access level for a privilege determines for a given object type at which levels within the organization hierarchy a user can act on that object type. Microsoft CRM has the following levels of access, starting with the most access:

Global Global. This access level exposes to the user all objects within the entire organization, regardless of the business unit hierarchical level to which the object or user belongs.

If an object in a user's organization is not private, then it is exposed to the user. Users with Global access automatically have Deep, Local, and Basic access as well.

Because this access level gives access to information throughout the entire organization, it should be restricted to match the organization's data security plan. This level of access is usually reserved for managers with authority over the organization.

Note The application refers to this access level as Organization.
Deep Deep. This access level exposes to the user objects in the user's business unit and all business units subordinate to the user's business unit.

If an object in the user's business unit or a child business unit is not private, then it is exposed to that user. Users with Deep access automatically have Local and Basic access as well.

Because this access level gives access to information throughout the entire business unit and subordinate business units, it should be restricted to match the organization's data security plan. This level of access is usually reserved for managers with authority over the business units.

Note The application refers to this access level as Parent: Child Business Units.

For example, if a user has Deep Read Account privileges, this user can read all accounts in his or her business unit, as well as all accounts in any child business unit of that business unit.
Local Local. This access level exposes to the user objects in the user's business unit.

If an object in the business unit is not private, then it is exposed to a user who has Local access. Users with Local access automatically have Basic access as well.

Because this access level gives access to information throughout the entire business unit, it should be restricted to match the organization's data security plan. This level of access is usually reserved for managers with authority over the business unit.

Note The application refers to this access level as Business Unit.

For example, if a user has Local Read Account privileges, this user can read all public accounts in the local business unit.
Basic Basic. This access level exposes to the user the objects he or she owns, objects that are shared with the user, and objects that are shared with a team of which the user is a member.

This is the typical level of access for sales and service representatives.

Note The application refers to this access level as User.

For example, if a user is assigned the Basic Read Account privilege, this user can read only the accounts that he or she owns or the accounts that are shared with him or her.
None None Selected. None.

Note Private objects are not supported through the Microsoft CRM application. However, the Microsoft CRM SDK includes the MakePublic/MakePrivate APIs. For more information, see Private Objects.

Examples

A customer service representative is set up with the Basic Read Account privilege in order to provide read access to accounts that he or she owns and to any accounts another user has shared with this user. This makes it possible for the representative to read the account data that is relevant to a service request, but not to change the data.

A data analyst is set up with the Local Read Account privilege in order to read account data and run account-related reports for all accounts in his or her business unit.

A finance officer for the company is set up with the Deep Read Account privilege in order to read account data and run account-related reports for all accounts in his or her business unit and in any subordinate business units.

More Information About Basic

The Basic access level is different from any other access levels because the user can create a situation where the he or she can no longer access a particular object that he or she owns. Two rights that you cannot revoke from yourself are Share and Read.

For example, let's say you have Basic Delete Account privileges. If you then share an account with yourself and do not grant yourself the delete rights, you will not be able to delete that account until you give yourself this right or remove the share to the account.


Object-Based Security

Object-based security applies to individual instances of objects and is provided by the use of access rights. The relationship between an access right and a privilege is that access rights apply only after privileges have taken effect. For example, if users do not have the privilege to read accounts, they will not be able to read any account, regardless of the access rights another user might grant them to a specific account (via sharing).

The following topics explain the details of object security.

  • Access rights
  • Sharing objects
  • Assigning objects
  • Private objects


Access rights

An access right is a right granted to a user for a particular object.

There are a number of access rights that a user can have on an object. The following table provides a description for each one.

Access rights | Enumeration name | Description
Read | CRM_ACCESS_READ | Controls whether the user can read an object.
Write | CRM_ACCESS_WRITE | Controls whether the user can update an object.
Assign | CRM_ACCESS_ASSIGN | Controls whether the user can assign an object to another user. See Assigning objects for more information.
Append | CRM_ACCESS_APPEND | Controls whether the user can attach another object to the specified object. The Append and Append To access rights actually work in combination with each other. Each time a user attaches one object to another, the user must have both of these rights. For example, when you attach a note to a case, you must have the Append access right on the case and the Append To access right on the note for the operation to work.
Share | CRM_ACCESS_SHARE | Controls whether the user can share an object with another user or team. Sharing allows another user access to an object. See Sharing for more information.
Append To | CRM_ACCESS_APPENDTO | Controls whether the user can append the object in question to another object. The Append and Append To access rights work in combination with each other. Each time a user attaches one object to another, the user must have both of these rights. For example, when you attach a file to a note, you must have the Append access right on the note and the Append To access right on the file attachment in order for the operation to work.
Delete | CRM_ACCESS_DELETE | Controls whether you can delete an object.

Creating objects

The right to create an object is not included in the preceding table because this right does not apply to an individual object, but rather to a class of objects. As a result, Create is handled as a privilege instead of as an access right. The user who creates an object will by default have all rights on that object, unless his or her other privileges forbid a specific right.

The Create privilege controls whether you can create an object. You can have the Create privilege with Local, Deep, or Global access level, and you will be able to create objects for others. However, you can create objects for yourself only if you have Create and Read privileges.

For more information about dependencies that relate to create privileges, see Security Dependencies.


Sharing objects

Sharing allows users to give other users or teams access to specific customer information on an ad-hoc basis. This is useful for private objects, and for sharing information with users in roles that have only the Basic access level. For example, in an organization that gives salespeople Basic read and write access to accounts, a salesperson might choose to share an opportunity with another salesperson so that they can both track the progress of an important sale.

For security reasons, it is important to develop the practice of sharing only the necessary objects among the smallest set of users possible, and to grant only the minimum access required for users to do their jobs.

Microsoft CRM provides the following sharing capabilities:

  • Share. Any user with share privileges on a given object type can share objects of that type with any other user in Microsoft CRM. If the shared object is private, the user needs the Share access right along with the share privilege for that object type. See Appendix A for a complete list of privileges. Sharing cannot cross organization boundaries. See below for the complete list of objects that support sharing.
  • Share rights. When you share an object with another user, you are given the opportunity to indicate what access rights (Read, Write, Delete, Append, Assign, and Share) you want to grant to the other user for that object, its sub-objects, and related objects. Access rights on a shared business object can be different for each user with whom the object is shared. However, you cannot give a user any rights that he or she would not automatically have for that type of object on the basis of the role assigned to that user. For example, if a user does not have Read privileges on accounts and you share an account with that user, the user will not be able to see that account.
  • Remove share. When you share an object with another user, you retain the right to stop sharing the object at a later date. After you remove the share for an object, the other user loses access rights to the object.

Tip Use the GrantAccess and RevokeAcess methods in the application programming interface (API) for sharing.

The following Microsoft CRM objects support sharing:

  • Account
  • Contact
  • Lead
  • Opportunity
  • Incident
  • Activity
  • Note
  • Contract
  • Quote
  • SalesOrder
  • Invoice
  • E-mail

Sharing objects in multiple contexts

A user might have access to the same object in more than one context. For example, a user might share an object directly with specific access rights, and he or she might also be on a team in which the same object is shared with different access rights. In this case, the access rights this user has on the object is the union of all the rights.

Sharing and inheritance

If an object is created and the parent object has certain sharing properties, the new object will inherit those properties. For example: Joe and Mike are working on a high priority lead. Joe creates a new lead and the first two activities, shares the lead with Mike, and selects cascade sharing. Mike makes a phone call and sends an e-mail regarding the new lead. Joe can see that Mike has contacted the company two times, so he does not make another call.

Sharing is maintained on individual objects. An object inherits the sharing properties from its parent and also maintains its own sharing properties. Therefore, an object can have two sets of sharing properties—one that it has on its own and one that it inherits from its parent.

Removing the share of a parent object removes the sharing properties of objects that it inherited from the parent. That is, all users who previously had visibility into this object no longer have visibility. Note that certain child objects might still be shared to some of these users if they were shared individually.


Assigning objects

Anyone with Assign privileges of an object can assign that object to another security principal (a user or team).

When an object is assigned to a new security principal, the new security principal becomes the owner of the object; the original user loses ownership of the object but automatically shares it with the new owner. All related objects and activities are also assigned to the new owner but are also shared by the original owner.

Note The Microsoft CRM application does not support assignment of objects to teams.

The following objects support the Assign method:

  • Account
  • Contact
  • Lead
  • Opportunity
  • Note
  • Contract
  • Quote
  • SalesOrder
  • Invoice
  • E-mail Template

When assigning an object using the Microsoft CRM application, the user is given the option of how to handle child objects. However, when the object is assigned through the API, the following always occurs:

  • When an object is assigned to another user, it is shared with the previous owner with full access. Either the new owner or the previous owner can remove the share relationship or lower the level of privileges the previous owner has on the object.
  • When the child of an object is assigned to another user, the previous owner will no longer own the object; however, they will share the object.


Private objects

The owner of an object can choose to mark the object as Private. An object that is marked as Private can be accessed only by the user who created the object and by those who share the object. For example, if a salesperson has a private contact, the sales manager cannot read that contact unless the contact owner shares it with him or her. The setting Private is exposed only in the API; it is not exposed in the Microsoft CRM application.


Licenses

A license is a set of Microsoft CRM application functionalities that an organization purchases. Licensing controls which privileges are enabled in a deployment. Each license type is associated with a group of privileges. A license for each module applies organization-wide, not only on a per-user basis.

The following table describes the class of the license objects.

Class | Description
CRMLicense | Contains methods for managing licenses

The following are the types of Microsoft CRM licenses:

  • Microsoft CRM Sales Standard
  • Microsoft CRM Sales Professional
  • Microsoft CRM Customer Service Standard
  • Microsoft CRM Customer Service Professional
  • Microsoft CRM Suite Standard
  • Microsoft CRM Suite Professional

The license filters the role privileges allowed for the users in an organization. See License features for a detailed description of how the license affects the privileges available for each object in the system.

A license can be updated. For example, a license can be updated from Suite Standard to Suite Professional, or for a deployment from 10 users to 1000 users. This upgrade is done by calling the CRMLicense.AddDeploymentLicense API. You do not need to remove the old license before adding the new one.

When a user is disabled, the license is still valid for that user. If you wish to reuse the license for a different user, you must first call CRMLicense.RevokeUserLicense and then call BizUser.Disable.


License features

The following table shows the application features supported for each object in the different licenses.

 | Sales Standard | Sales Professional | Customer Service Standard | Customer Service Professional | Suite Standard | Suite Professional
Account | All | All | All | All | All | All
Contact | All | All | All | All | All | All
Lead | All | All | Read | Read | All | All
Opportunity | All | All | All except Create | All except Create | All | All
Incident | Read | Read | All | All | All | All
Activity | All | All | All | All | All | All
Note | All | All | All | All | All | All
Contract | None | Read | None | All | None | All
Contract Template | None | Read | None | All | None | All
Quote | None | All | None | Read | None | All
SalesOrder | None | All | None | Read | None | All
Invoice | None | All | None | Read | None | All
E-mail Template | All | All | All | All | All | All
Product | None | All | None | All | None | All
Competitor | None | All | None | Read | None | All
Sales Literature | None | All | None | Read | None | All
Subject | Read | Read | All | All | All | All
Territory | All | All | All | All | All | All
Business Unit | All | All | All | All | All | All
User | All | All | All | All | All | All
Team | All | All | All | All | All | All
Role | All | All | All | All | All | All
Workflow Process | None | All | None | All | None | All
Workflow Process Instance | None | All | None | All | None | All
News Article | All | All | All | All | All | All
Article | Read | Read | All | All | All | All
Query | All | All | All | All | All | All
Activity Party | All | All | All | All | All | All
Article Template | Read | Read | All | All | All | All
Organization | All | All | All | All | All | All
Organization UI | All | All | Read | Read | All | All
E-mail | All | All | All | All | All | All
License | All | All | All | All | All | All
Customization | All | All | All | All | All | All
User Settings | All | All | All | All | All | All
Queue | All | All | All | All | All | All


License combinations for deployment

Not all license configurations can work in the same deployment. For example, if one user is using the Sales Professional client, then all clients in the deployment must either be using that license or another license that can be combined with the Sales Professional license, such as the Standard Customer Service license.

The following table shows the license combinations allowed in a single deployment of Microsoft CRM. Each row shows what licenses can be combined.

Sales Standard | Sales Professional | Customer Service Standard | Customer Service Professional | Suite Standard | Suite Professional
Valid combination |  | Valid combination |  |  |
Valid combination |  |  | Valid combination |  |
Valid combination |  |  |  | Valid combination |
 |  | Valid combination |  | Valid combination |
 | Valid combination | Valid combination |  |  |
 | Valid combination |  | Valid combination |  |
 | Valid combination |  |  |  | Valid combination
 |  |  | Valid combination |  | Valid combination
Valid combination |  | Valid combination |  | Valid combination |
 | Valid combination |  | Valid combination |  | Valid combination


License combinations for users

Licenses assigned to a user (along with privileges) are checked when a user logs on or tries to synchronize. The license a user has will always override any privileges in a role that are not enabled with the license.

The following rules apply to licenses and user management:

  • Licenses override privileges. For example, a user needs to have a valid license to be able to use sales or service functionality.
  • A user can have any privileges that are allowed in a deployment, but the privileges are filtered by the licenses assigned to the user.
  • A user cannot be assigned more than two licenses at a time.

The following table shows the license combinations that are allowed for a user.

Sales Standard | Sales Professional | Customer Service Standard | Standard Professional | Suite Standard | Suite Professional
Valid combination |  | Valid combination |  |  |
 |  |  | Valid combination |  |
 | Valid combination | Valid combination |  |  |
 | Valid combination |  | Valid combination |  |


Active Directory

Microsoft CRM uses Windows® Active Directory® to store information about users, business units, teams, and roles. When you install Microsoft CRM, a new organizational unit (OU) object is created that uses the Organization name you have specified.

Users

To add a new user to Microsoft CRM, the user must first exist in Active Directory. Each user has a user object in Active Directory.

Business Units and Teams

When a business unit is created in Microsoft CRM, it shows up as an organizational unit (OU) object in Active Directory within the OU for the root organization of the business unit hierarchy.

When a team is created or modified, it shows up as a security group object within the Microsoft CRM OU object in Active Directory. When a user is added to a team, the user becomes a member of the team in Active Directory.

Roles

Each role that is defined in Microsoft CRM is implemented as up to three Active Directory security groups. The security groups for each role are as follows:

  • MSCRM Role (role_name). This security group is present for all roles and has all users assigned to this role as members. On objects for which the role grants the Local access level for an access right, Microsoft CRM grants read access to this group on every object of that type in the business unit.
  • MSCRM Glbl (role_name). This security group is created only when a role has any objects with Global access levels. The MSCRM Role (role_name) group is a member of this group. On objects for which the role grants the Global access level for an access right, Microsoft CRM grants the access right to members of the MSCRM Glbl (role_name) group on every object of that type in the organization.
  • MSCRM Deep (role_name). This group is created only when a role has any objects with Deep access levels. The MSCRM Role (role_name) group is a member of this group. On objects for which the role grants the Deep access level for an access right, Microsoft CRM grants the access right to the MSCRM Deep (role_name) group on every object of that type in the business unit and all of that unit's child business units.

For example, assume John is a member of the Vice President of Sales role, a role defined as having Global read, Deep create, and Local write privileges on activities. As a result:

  1. John can read all activities in the organization. That's because John is a member of the MSCRM Role (Vice President of Sales) group, which in turn is a member of the MSCRM Glbl (Vice President of Sales) group. The Glbl group has been granted read access on all activities in John's organization.
  2. John can create activities in his business unit and all subordinate business units. That's because John is a member of the MSCRM Role (Vice President of Sales) group, which in turn is a member of the MSCRM Deep (Vice President of Sales) group. The Deep group has been granted create access on all activities in John's business unit and all of this unit's child business units.
  3. John can make changes to all activities in his business unit. That's because John is a member of the MSCRM Role (Vice President of Sales) group and this group (the Role group) has been granted write access on all activities in John's home business unit.


Security Dependencies

Sometimes security dependencies exist because it is necessary to have more than one access right to perform a given action. For example, if you have the access right CRM_ACCESS_CREATE for accounts, you can create an account object. However, unless you also have CRM_ACCESS_READ access for accounts, you cannot create an account and be the owner of that new account. You can find the access rights enumeration in the ACCESSRIGHTS class.

The following table shows the access right dependencies for the actions specified.

Action | Access rights required
To Create an object and be the object owner | CRM_ACCESS_CREATE CRM_ACCESS_READ
To Share an object | CRM_ACCESS_SHARE – required by the person doing the share operation. CRM_ACCESS_READ – required by the person doing the share operation and also by the person with whom the object is being shared.
To Assign an object | CRM_ACCESS_ASSIGN CRM_ACCESS_WRITE CRM_ACCESS_READ
To Append To an object | CRM_ACCESS_READ CRM_ACCESS_APPENDTO
To Append an object | CRM_ACCESS_READ CRM_ACCESS_APPEND

Another type of dependency exists when objects are subordinate to another object. The opportunity and contact objects cannot exist on their own. Each is always attached to an account. In this case, in order to create an opportunity or a contact, you must have the access right CRM_ACCESS_APPENDTO on accounts as well as the access right CRM_ACCESS_APPEND on opportunities or contacts.


Security Best Practices

The following guidelines will help you create a secure Microsoft CRM system that protects your business data:

  • Require that all users use strong passwords for their accounts. Refer your users to the topic "Creating Strong Passwords" in Windows 2000 help.
  • Have an approved security data plan in place for the organization's Microsoft CRM implementation.
  • When setting up Microsoft CRM, divide your organization into business units that match the organizational structure, so that it is easy to restrict access based on roles.
  • Assign all users roles with the minimum access levels and access rights required for them to do their jobs.
  • Do not create accounts, such as Sales or Service, that multiple employees would use.
  • If a user needs additional access levels or rights, create a new role with those specific privileges and add the user to the new role. A user's rights are the union of all the roles to which he or she has been assigned. Don't grant the original role privileges that are needed only by one or a few members.
  • When appropriate, use sharing to give specific users specific rights on individual objects, rather than broader privileges on all objects of a given type.
  • Use teams to create cross-functional groups, so that specific objects can be shared with the team.
  • Train users who have sharing access rights to share the minimum information needed.


Microsoft CRM Object Model

This section covers the object model for the Microsoft Business Solutions CRM platform. The object model illustrates the developer's view of the business and service objects. Described here are the core objects used by all Microsoft CRM developers, such as Contact, Account, Lead, and Opportunity. This section describes the logical view of Microsoft CRM, capturing the known set of core relationships and behaviors.

Extensible Schema

The schema for the Microsoft CRM objects is extensive enough to cover common data. However, there will be some business-specific data that the user might want to store along with the customer data. To enable this, the Microsoft CRM tools allow you, as well as end-users, to add custom fields. The following objects have an extensible schema:

  • Account
  • Competitor
  • Contact
  • Contract
  • ContractDetail
  • CustomerAddress
  • Incident
  • Invoice
  • InvoiceDetail
  • Lead
  • Opportunity
  • OpportunityProduct
  • Product
  • Quote
  • QuoteDetail
  • SalesLiterature
  • SalesOrder
  • SalesOrderDetail

For more information about extending the database schema, see the Microsoft CRM Deployment Manager Help documentation.


Overview

The object model in the Microsoft CRM Software Development Kit (SDK) is divided into five parts. Each part is explained in the following sections:

Core System Management

  • Business Management
  • User and Team Management

Customer Management

  • Contact Management
  • Account Management
  • Activity Management
  • Queues
  • Notes and Attachments
  • Query

Sales Force Automation and Marketing

  • Opportunity Management
  • Lead Management
  • Salesperson Management
  • Product Catalog Management
  • Quote, Order, and Invoice Management
  • Sales Literature Management
  • E-mail Management
  • Competitor Tracking
  • Synchronization with Microsoft CRM Sales for Outlook

Customer Service Management

  • Contracts
  • Incident (Case) Management
  • Knowledge Base
  • Subjects

Miscellaneous

  • Workflow and Rule Management
  • Customization Objects
  • Reporting


Core System Management

The objects described in this section are the core objects used to set up the Microsoft CRM application. This includes setting up the businesses, users and teams that define your organization as well as details on working with objects in the system.

The topics covered here are:

  • Actions on Objects. Specifies the general actions that can be performed on most objects.
  • Business Management . Defining the business hierarchy and its operating policies.
  • User and Team Management . Setting up users, teams, and security roles.


Actions on Objects

The following table describes the actions allowed on objects in general. Not all actions are allowed on all objects. For complete details, see the API Reference section.

Action | Description
Append | Objects can be added to the object in question. For example, a note can be added to an opportunity if the caller has Append rights on the opportunity.
Append To | Append To is the opposite behavior from Append. In this case, the object in question can be appended to another object. For example, a note can be attached to an opportunity if the caller has Append To rights on the note. (Append To can also be thought of as "Attach").
Share | The Share action allows a caller to grant or revoke access to an object to another user or team. Sharing is done using the GrantAccess, ModifyAccess and RevokeAccess methods.
Assign | The Assign action changes ownership of the target object. In the Microsoft CRM platform, many objects can be owned by either users or teams (the exception is objects that can be routed, such as activities and cases). The Microsoft CRM application does not allow teams to own objects. When an entity is assigned to another user, the previous owner will still have access to this entity. They will not have ownership of the entity; however, they will be shared the entity.
Delete | This action deletes an object. For some objects you are given the choice of deleting all child objects as well.
Retrieve | This action retrieves an object from the database.
Update | The Update action allows you to modify the contents of an object.
Create | Although Create is not an object-level action, it is included here for completeness. Create is done at the class level.

Creating Objects

To create an object you need to have create privileges for the class of objects. However, there are more privileges you need in order to own an object. For example, if you have security access CRM_ACCESS_CREATE for accounts, you can create an account object and assign it to another user. However, unless you also have CRM_ACCESS_READ access for accounts, you cannot create an account and be the owner of that new account. See Security Dependencies for more information.

Sharing Objects

Sharing is the way Microsoft CRM users can give other users access to customer information on an ad-hoc basis. For example, a salesperson might choose to share an opportunity with another salesperson so that they can both track the progress of an important sale.

The SDK provides methods for sharing objects. A user must have Share rights to share customer-related objects, such as contacts, accounts, opportunities, cases, and orders, with any other user in the system. When an object is shared, you can specify the rights to grant for the shared object. You can also choose to share all objects associated with the object being shared.

The following table describes the rules for sharing objects:

  • Anyone with share privileges on an object can share it with additional users or teams.
  • Anyone with share privileges on an object can set privileges for that object that control how a user it is shared with can access it.
  • Access on a shared object can be set to any access privilege.
  • Access privileges on a shared object can be different for each user it is shared with.
  • An object can be shared with the same security principal only once. A user can share an object if they have share privileges on that object.
  • Anyone with share privileges on a business object can modify the access privileges for users with which that object has been shared.
  • Anyone with share privileges on a business object can remove sharing for a specified user with which the object was previously shared.
  • Anyone with share privileges on a business object can remove sharing for all users with whom the object was previously shared.

Deleting Objects

The following rules apply to deleting objects:

  • When deleting an object, all appended objects are deleted.
  • When deleting an object, other objects with simple associations will not be deleted.
  • When deleting an account or contact, the platform checks for the user's privileges and for object state such as an open contract. Depending on the outcome of those checks, either all the objects down the parent hierarchy are deleted or the delete fails and none are deleted.


Business Management

Business management objects are used to define the organization hierarchy and its operating policies.

This SDK provides you with the methods you need to manage your organization, including those to create business units, edit business information, and delete business units.

Definition of Terms

A deployment is a single installation of Microsoft CRM. This is a single database and any schema customization is done at this level.

An organization is the entity that is internal to the customer relationship management process. The organization is the top level of the Microsoft CRM business hierarchy. The organization can be a specific business, a holding company, a corporation, and so on. There can be only one organization per Microsoft CRM deployment. The organization is divided into business units.

A business unit is a unit of the top-level organization. Business units can be parents of other business units (child business units).

A parent business unit is any business unit with one or more business units that report to it in the hierarchy.

A child business is a business unit that is immediately under another business unit in the business hierarchy of an organization.

Classes

The following table describes the classes of the business management objects.

Class | Description
CBizMerchant | Methods to manage business units
CBizOrganization | Methods to manage organizations
CBizPrivilege | Methods to manage business privileges
SecRole | Methods to manage security roles

Details

The following table lists which objects are managed at each level in the deployment and organization hierarchy.

Level | Objects
Deployment | Database Schema Licenses
Organization | Forms Workflow Rules Views E-mail Templates Licenses
Business Unit | Security Roles Customized Workflow Rules E-mail Templates
User | E-mail Templates

Organization

Actions that can be performed on an organization include: Create, Disable, Enable, Retrieve, and Update. For more general information, see Actions on Objects.

Business Unit

Actions that can be performed on business units include: Create, Disable, Enable, Retrieve, Set Parent, and Update. For more general information, see Actions on Objects.

Privileges

For a detailed description of privileges, see Privileges in the Microsoft CRM Security Model section.

The only action that can be performed on privileges is Retrieve. For more general information, see Actions on Objects.

Security Roles

For a detailed description of privileges see Roles in the Microsoft CRM Security Model section.

Actions that can be performed on security roles include: Create, Delete, Retrieve, Assign Role to Users, Remove Role from Users, and Add and Remove privileges to roles. For more general information, see Actions on Objects.


User and Team Management

User management is the area of Microsoft CRM used to:

  • Create and maintain user accounts and profiles.
  • Assign roles to a user.
  • Indicate for which business unit a user works.
  • Indicate who a user's direct manager is.

A team is an organizational structure in Microsoft CRM designed to allow groups of users across business units to easily share customer information and work together to meet customer needs.

Definition of Terms

A user is any person who works for a business unit who uses the Microsoft CRM application. Each user has a user account. All users must be associated with only one business unit. This association controls which customer data the user will have access to. Included in the user's account is information such as the user's telephone numbers, e-mail address, and a link to the user's manager. Each user has privileges and rights to manage their own personal settings. Each user corresponds to a user in the Active Directory for that organization.

A team is a group of users. This organizational structure is designed to allow groups of users across an organization to easily share information and work together. Each team must be associated with only one business unit. A team can include users from any business unit, not just the one the team is associated with. Users can be associated with more than one team.

A manager can add new users, create and execute queries on users, and perform actions on one or more users. A managing user with Parent: Child Business Units privileges can create users and assign them to any business unit in the hierarchy, while a managing user with Business Unit privileges can manage users only within his or her business unit.

Classes

The following table describes the classes of the user and team management objects.

Class | Description
BizTeam | Methods to manage teams
BizUser | Methods to manage users

Details

Managing users involves many different activities, including adding users, setting security roles, and placing users into a reporting hierarchy. Access to each of these features is protected by security privileges that the user has based on the user's security role. A user profile must first be created and saved before the user can be assigned security roles or associated with teams.

A Microsoft CRM user account can be either Enabled or Disabled. Microsoft CRM will allow only Enabled users to log on to the application and each Enabled user must have a paid license. A user's account can be set to Disabled for keeping track of historical information (for example, a salesperson who left the company) or to remove them from workflow processes (for example, if they are on vacation).

The following are the basic operations for a user: Create, Enable, Disable, Set Parent (manager), Set Business, Retrieve and Update. For more general information, see Actions on Objects.

A team is a group of users who are called team members. A team must report to a business unit, but team members are not necessarily from this business unit. Creating a team allows greater flexibility for sharing and collaboration.

A team can is used mainly for efficient sharing of business objects with a group of users. A user can share business objects with a team or can assign business objects to a team. Any object owned by a team is automatically accessible to any user who is assigned to the team as if the object were directly assigned to them.

Teams are often formed to allow data sharing. For example, if a user has the right to create cases, but can only read orders, they will have those same rights for objects owned by a team they are assigned to.

Note The Microsoft CRM application does not support business-object assignment to teams.

The following are the basic operations for a team: Create, Add and Remove Members, Retrieve and Update. For more general information, see Actions on Objects.

Once a team is created, users and objects are assigned to it; the rest is automatic. Users will automatically have access to the team's information and be able to act on it as if it were directly assigned to them.

Sharing

Sharing is the way Microsoft CRM users can give other users access to customer information on an ad-hoc basis. For example, a salesperson might choose to share an opportunity with another salesperson so that they can both track the progress of an important sale.

The SDK provides methods for sharing objects. A user must have Share rights to share customer-related objects, such as contacts, accounts, opportunities, cases, and orders, with any other user in the system. When an object is shared, you can specify the rights to grant for the shared object. You can also choose to share all objects associated with the object being shared.


Customer Management

The objects described in this section are the core objects used to enable a business to have more productive and successful relationships with its customers. This includes the objects necessary for managing customers for the purposes of identifying, selling to, and providing service to those customers.

The topics covered here are:

  • Contact Management . Contacts are used to store information about all the people (customers, suppliers, and so on) your users need to interact with.
  • Account Management . Managing the information about your accounts.
  • Activity Management . Managing the events that are attached to contacts, accounts, opportunities, and cases.
  • Queues . Managing queues of incidents (cases) and activities.
  • Notes and Attachments . Textual notes and files attached to objects in the system.
  • Query . A rich query engine used for finding objects in the system.


Contact Management

The Contact object is one of the core objects in Microsoft CRM to which most other objects are attached or parented. It represents a person with whom a business unit has a relationship, such as a customer, a supplier, or a colleague. Included in this object is contact, professional, personal, and family information, as well as multiple addresses.

Definition of Terms

A contact represents a person with whom a business unit has a relationship.

Classes

The following table describes the classes of the contact management objects.

Class | Description
CRMContact | Methods to manage contacts
CRMCustomerAddress | Methods to manage additional addresses (This class is needed if you want to store more than two addresses for a contact.)

Details

Both accounts and contacts are part of managing customers and are related to each other in the following ways:

  • A contact can be a stand-alone object.
  • A contact can be a parent to almost every other object. A contact can be a parent to every object type except accounts and contacts.
  • A contact can have only one account as its parent.
  • A contact can be marked as the "primary contact person" for an account using the CrmAccount.SetPrimaryContact method.

A contact is usually an individual person. The Contact object stores all information about a person such as an e-mail address, street address, multiple phone numbers, and any other information that relates to the contact, such as birthday or anniversary date. Depending on the type of customers a business unit has, it needs either only contacts or contacts and accounts to give a full view of its customers.

The basic operations that you can perform on a contact include Create, Read, Update, and Delete.

Linking objects such as Activities and Notes to the Contact object enables the user to see all the communication the user has had with a customer, any actions the user has taken on behalf of the customer, and all information the user needs about the customer.

Actions that can be performed on contacts include: Activate, Assign, Share, Create, Delete, Retrieve, and Update. For more general information, see Actions on Objects.


Account Management

The Account is one of the objects in Microsoft CRM to which most other objects are attached or parented. In Microsoft CRM, it represents a company with which the business unit has a relationship. Information included in an account is all relevant contact information, company information, category, relationship type, and address information.

Account management is one of the crucial concepts of CRM because an organization wants to see all the activities they are having or have had with another company. It is at the account level that all of these activities come together.

Definition of Terms

An account represents a company with which a business unit has a relationship.

Classes

The following table describes the classes of the account management objects.

Class | Description
CRMAccount | Methods to manage accounts
CRMCustomerAddress | Methods to manage additional addresses (This class is needed if you want to store more than two addresses for an account.)

Details

The Account object can be a parent to virtually any other object, including another account. Both accounts and contacts are part of managing a customer and are related to each other in the following ways:

  • An account can be a stand-alone object.
  • An account can have only one account as its parent.
  • Accounts can have multiple child accounts.
  • Accounts can have multiple child contacts.

The basic operations that you can perform on an account include Create, Delete, Read, Update, Delete, Assign, and Share.

For more general information, see Actions on Objects.


Activity Management

Activities are tasks a user performs when contacting customers, for example, sending letters or making telephone calls. Users can create activities for themselves to do, can assign them to someone else to complete, or can share them with others. The Microsoft CRM SDK provides security settings that can be used to determine the access rights for activities.

Definition of Terms

An activity is a task performed (or to be performed) by any system user. An activity can be thought of as any action for which an entry can be made on a calendar. An activity has time dimensions (start time, stop time, due date, duration) that help identify when the action occurred or is to occur. Activities also carry some basic properties that help identify what action the activity represents (title, description). Activities can be pending, in progress, canceled, and completed. The completed status of an activity will carry several sub-statuses to further clarify the way that the activity was completed.

Activities involve one or more participants. For a meeting activity, the participants are those contacts or users attending the meeting. For a phone call or fax activity, the parties are the caller and person who is called.

Classes

The following table describes the classes of the activity management objects.

Class | Description
CRMActivity | Methods to manage activities
CRMActivityAttachment | Methods to manage e-mail attachments

Details

All activities a salesperson or customer service representative can perform can be captured in the Activity object. An activity can be one of the following:

  • Task
  • Fax
  • Phone call
  • E-mail
  • Letter
  • Appointment

Each type of activity supports the ability to store relevant information about the activity.

There are two types of association for activities. The first is an implicit association where the contact, account, or lead is a party to the activity, for example, an entry on an e-mail "To:" line. All activities also have an owner, which is usually the person who created the activity. An activity that is assigned to someone else is a delegated activity.

Activities can be created in three ways. A user can create a new activity (either as something to do in the future or as a record of something just done). A user can create a new activity and assign it to someone else (for instance, to another team member). Or, the workflow engine can create an activity and assign it to a user based on a predefined process that the system administrator or channel partner has created.

Activities exist in three states in Microsoft CRM: Open, Closed, and Canceled (or Skipped).

The type of access a user has to activities created by others, and others have to activities created by a user, are determined by assigned security privileges.

The following table lists the rules for activities.

Rules
The owner of an activity has full access to the activity.
The owner can share the activity with other users and can assign it to another user.
The user who is sharing the activity sets the type of access (read-only or read/write) that other users will have.

Actions that can be performed on activities include: Cancel, Close, Handle, Open, Route, UnHandle, Share, Create, Delete, Retrieve and Update. For more general information, see Actions on Objects.

Activity Types

The following table describes the types of activities in Microsoft CRM.

Activity | Description
Basic activity | This is the basic activity type. All other activity types are derived from this type and share its attributes.
E-mail | An e-mail is an activity that is delivered using e-mail protocols. An e-mail tracks additional information about the activity, including a MIME type, message ID, and message header (or envelope).
Phone call | A phone call is an activity that tracks the call outcome (hung up, no answer, left voice mail, wrong number, and so on).
Fax | A fax is an activity that tracks call outcome and number of pages. The activity can optionally store the electronic copy of the actual document.
Incident resolution | Incident resolution is recorded when a user is in an incident (case) and wants to close it.
Letter | A letter is a simple activity that tracks the delivery of a postal message. The activity can optionally store the electronic copy of the actual letter.
Incident Entry | Incident entry is to track non-standard activities that require time tracking.
Opportunity closed | Opportunity closed is recorded when user is in an opportunity and wants to close the opportunity.


Queues

Queues are containers that hold activities and incidents (cases) in Microsoft CRM. They make it easier for these objects to be moved around the system, handled and assigned to different individuals within the system.

Definition of Terms

A queue is a collection of unassigned cases and activities for an organization.

A public queue is a queue that is created by the business unit to help organize where activities and cases should be routed. The business unit can add queues, delete queues, and update queues.

A private queue is a queue that contains all items assigned to a user that they have not started working on yet. This queue is fixed and the user cannot delete it. Each user has a private queue.

A work in progress queue is a queue that contains all items assigned to a user that they are currently working on. Each user has a work-in-progress queue. This queue is fixed and the user cannot change it.

Classes

The following table describes the classes of the queue objects.

Class | Description
CRMQueue | Methods to manage queues
CRMQueueItem | Methods to manage an item in a queue

Details

There are three types of queues: Public, Private, and Work-in-progress. You can assign activities and incidents (cases) to queues using the Acitivity::Route or Incident::Route methods. Incidents can also be assigned to a queue by a workflow rule.

Actions that can be performed on queues include Create, Delete, Retrieve, and Update. For more general information, see Actions on Objects.


Notes and Attachments

Notes and attachments provide an easy way to append information to any object in the Microsoft CRM application.

Definition of Terms

Notes are text entries that can be associated on an ad-hoc basis with any object in Microsoft CRM.

An attachment is a note with a file or files attached to it. An attached file can be any standard PC file format, including Microsoft Word documents, Microsoft Excel spreadsheets, CAD files, and PDF files. An attachment can be associated with any other object in the system.

Classes

The following table describes the classes of the note and attachment objects.

Class | Description
CRMNotesManager | Methods to manage notes

Details

For more information about how to attach a file to a note, see Upload or Download an Attachment to a Note.

The following operations can be performed on a note or attachment: Create, Read, Update, Assign, Share, and Delete. For more general information, see Actions on Objects.


Query

The Query object allows you to construct queries directly against the objects in the Microsoft CRM database. These queries are constructed using a proprietary format called Fetch XML.

Definition of Terms

A query is a full-text search based on properties from one or more objects.

Classes

The following table describes the classes of the query objects.

Class | Description
CRMQuery | Methods to manage queries

Details

The CRMQuery::ExecuteQuery allows you to construct a query directly against the objects in the database. While at first glance this may seem more powerful, especially for developers used to constructing queries in SQL, using the Retrieve methods will have better performance. This is due to the parsing and validation of the Fetch XML.

For more information about using Fetch XML, see the Fetch XML schema.


Sales Force Automation and Marketing

The objects described in this section are targeted at helping salespeople identify and track selling opportunities more effectively and efficiently.

The topics covered here are:

  • Lead Management . Tracking contacts that might lead to an opportunity to make a sale.
  • Opportunity Management . Tracking opportunities that might lead to a sale.
  • Salesperson Management . Managing salespeople and their quotas.
  • Product Catalog Management . Managing the collection of products with their pricing information.
  • Quote, Order, and Invoice Management . Managing the information related to potential orders.
  • Sales Literature Management . Managing the collection of documents related to the business unit.
  • E-mail Management . Managing inbound and outbound communications through e-mail.
  • Competitor Tracking . Tracking the competitors for an organization.
  • Synchronization with Microsoft CRM Sales for Outlook . Synchronizing the Microsoft CRM database with Microsoft CRM Sales for Outlook.


Lead Management

Lead management is a key feature within the Microsoft CRM platform and is designed to fully automate lead management and opportunity management for an organization's sales force.

Definition of Terms

A lead is an individual who has indicated an interest in finding out more about the products or services offered by a business unit. The lead has been identified by a salesperson as a recipient for targeted information through e-mail or other communication activities.

Classes

The following table describes the classes of the lead management objects.

Class | Description
CRMLead | Methods to manage leads

Details

Lead management is largely the same as opportunity management, except that leads are kept separate from customer and opportunity data until the salesperson or the system converts a lead to an opportunity with a customer contact.

Leads are used to track contacts and accounts who might be potential customers, but who have not yet been qualified. The following items can be associated with a lead: contact and account information, customer requests, activities, notes, and attachments. A link is maintained between the lead and any accounts and contacts, in the database. This is done using CrmLead.SetAssociation/RemoveAssociation. This makes it possible to generate reports that indicate the value of different lead sources.

When a lead is entered into a Microsoft CRM system, the workflow engine can be used to automatically route it to a specific user or team based on rules defined by the business unit or channel partner. Upon "qualification," the lead is either converted to an opportunity or inactivated, but retained to allow for accurate business reporting, for instance, analysis of the effectiveness of different lead sources. For more information, see Workflow and Rule Management.

The possible states for a lead are: Open, Qualified, and Disqualified.

The following operations can be performed on a lead: Create, Update, Share, Assign, Delete, Accept, Disqualify, Qualify, Reject, and Recall. For more general information, see Actions on Objects.


Opportunity Management

Each opportunity represents a chance to sell something to a qualified customer. Salespeople use opportunities to keep track of each sales engagement on which they are currently working. You can track things like what stage (introduction, qualification, needs identification, proposal generation, and so on) an opportunity is in, the revenue potential, the probability of closing the deal, and the orders that are generated.

Definition of Terms

An Opportunity object is used to track each sales engagement.

Classes

The following table describes the classes of the opportunity management objects.

Class | Description
CRMOpportunity | Methods to manage opportunities

Details

Each opportunity must be associated with at least one account or contact. Salespeople can track the following information in an opportunity: contact information, state and status information, salesperson, assignment of revenue credit, likelihood of closure, and projected closure dates. Opportunities can be linked with competitor information and analyzed to identify effective selling strategies.

The following objects can be associated with an opportunity to provide a complete set of information about the sales engagement: activities, notes and attachments, competitors, quotes, orders, and sales literature.

There are six basic operations that can be performed on an opportunity:

  • Create. Enter a new opportunity into Microsoft CRM.
  • Update. Enter new data or update the status of an opportunity.
  • Share. Give another user access to an opportunity.
  • Assign. Assign an opportunity to another user.
  • Delete. Remove an opportunity and associated objects from Microsoft CRM.
  • Close. Close an opportunity and indicate the final sales result: Won or Lost.

For more general information, see Actions on Objects.


Salesperson Management

The Salesperson, Territory, and FiscalCalendar objects are used to track information regarding the sales for a salesperson.

Definition of Terms

A salesperson is any user in Microsoft CRM who has a quota assigned to them for the current fiscal period.

A quota is a revenue objective specified as a specific currency amount that has been assigned to a salesperson for a specified fiscal period.

A territory is a geographical area that a salesperson is assigned to.

A fiscal calendar is a span of time during which the financial activities of an organization are calculated. A fiscal year is divided into fiscal periods, typically defined as semesters, quarters, or months.

Classes

The following table describes the classes of the salesperson management objects.

Class | Description
CRMFiscalCalendar | Methods to manage salespeople's quotas
CRMSalesPerson | Methods to retrieve salesperson information
CRMTerritory | Methods to manage territories

Details

Microsoft CRM supports a simple implementation of territory management. You can create a territory object that functions similarly to a team object. Just as with teams, users can be assigned to territories and the territory then becomes a property of the user. The territory object is referred to as a salesperson. This enables the business to leverage the territory property of the user in a number of ways:

  • You can use the workflow engine to use the territory property of users to perform actions such as to assign leads and opportunities based upon territories.
  • You can use reporting in the Microsoft CRM application to roll up totals by territory.
  • You can retrieve objects based on the territory of the user owning that object.

Quotas are used to help manage the success of salespeople relative to their sales goals. A quota is essentially a sales goal for a salesperson for a given time period. Each user in Microsoft CRM can be assigned sales quotas by fiscal period.

Salesperson

The only action that can be performed on a salesperson is Retrieve. For more general information, see Actions on Objects.

Territory

Actions that can be performed on a territory include: Create, Delete, Retrieve, and Update. For more general information, see Actions on Objects.

Fiscal Calendar

In Microsoft CRM the fiscal calendar defines a fiscal year, which is a span of time during which the financial activities of an organization are calculated. A fiscal year is divided into fiscal periods, typically defined as semesters, quarters, or months. The organization determines the dates that begin and end its fiscal year, which may not correspond to a traditional calendar year. When a salesperson is assigned a quota in Microsoft CRM, the timeframe for achieving the quota is based on the fiscal year of the organization.

Actions that can be performed on a fiscal calendar include: Create, Delete, Retrieve, and Update. For more general information, see Actions on Objects.


Product Catalog Management

The Microsoft CRM SDK offers objects to create a full-featured product catalog, including support for complex pricing models. The product catalog supports a large number of products, multiple pricing models, and complex discounting models. In addition, products can be associated with each other through "kits" or "substitute" relationships.

Definition of Terms

A product is either a physical inventory item (like lumber or a nail), or a service (like a hair cut or tree pruning) that a company sells. Products from the product catalog can be used to build quotes and orders, and can be associated with opportunities and/or service cases. In addition, each product can contain links to sales literature as well as links to information about competitors and their products.

A product catalog is a collection of products with their pricing information.

Price lists contain one to many individual product prices, aggregated together into a list for categorization purposes, allowing for easier maintenance and usability of the list.

Units and unit groups contain one to many types of unit of measurement descriptions, as calculated off a base unit. This schedule is then tied to one or many products, which then forms the valid unit group that the product can be sold in.

Discounts allow for a product to have different sales prices, depending upon the quantity purchased.

A discount list is an aggregation of different discounts, specifying how much of a discount the user can get when the purchasing amount falls between certain ranges. Discount lists can exist at each quantity level, along with detail lines containing the quantity break points, and the reduction in the price.

Pricing options are configurations that allow a business unit to control how prices are calculated within the Microsoft CRM pricing engine. Parameters that can be configured are: Quantity Selling options, Pricing Method, Rounding Policy, and Rounding Option.

Classes

The following table describes the classes of the product catalog management objects.

Class | Description
CRMDiscount | Methods to manage discounts
CRMDiscountType | Methods to manage discount lists
CRMPriceLevel | Methods to manage price lists
CRMProduct | Methods to manage products
CRMProductPriceLevel | Methods to manage product price lists
CRMOpportunityProduct | Methods to manage opportunity products
CRMUoM | Methods to manage units
CRMUoMSchedule | Methods to manage unit groups

Details

The following operations can be performed on a product:

  • Create
  • Update
  • Delete (not recommended)
  • Deactivate (You should deactivate products that are no longer available instead of deleting them, because they are included in past orders, quotes, opportunities, cases, and so on.)
  • Search (either by product name or part number)
  • Print

Other operations for a product:

  • Associate with an account
  • Associate with other products (as a substitute)
  • Associate with knowledge base subjects
  • Add a note or attachment
  • Associate with a kit
  • Associate with a case
  • Associate with sales literature
  • Associate with a competitor
  • Incorporate into a quote
  • Associate with a sales quota
  • Add to an invoice
  • Add to a sales order

For more general information, see Actions on Objects.

For more information about pricing methods, see Pricing Methods.


Quote, Order, and Invoice Management

The Microsoft CRM SDK supports robust quote building. You can build a quote by selecting products directly from the product catalog, specifying the price list (such as whole or retail) and the requested number of units, and applying volume discounts and manual discounts, assuming that you have the privileges to enter them. Multiple pricing models are supported, such as wholesale versus retail, and discounting can be done by line item based on volume, customer type, and a manual override. In addition, overall discounts can be applied to an entire quote.

Definition of Terms

A quote is a formal offer for products and/or services proposed at specific prices and related payment terms that is sent to a prospective customer.

An order is a quote that has been accepted.

An invoice is an order that has been billed.

Classes

The following table describes the classes of the quote, order, and invoice objects.

Class | Description
CRMQuote | Methods to manage quotes
CRMQuoteDetail | Methods to manage quote details
CRMSalesOrder | Methods to manage sales orders
CRMSalesOrderDetail | Methods to manage sales order details
CRMInvoice | Methods to manage invoices
CRMInvoiceDetail | Methods to manage invoice details

Details

You can create a quote, save it as a draft, and specify whether it is open (presented to the customer) or closed (completed, either as an order or not). Each quote can have a due date (when it was promised to the customer), effective dates (when it must be accepted or rejected by), and the requested delivery dates. In addition, each quote can contain many "ship to" addresses (by line item) or a "will call" setting for items to be picked up by the customer.

If a quote is created from within an opportunity, Microsoft CRM will use any products that have been associated with the opportunity as the basis for the draft. In addition, as quotes are updated, the potential revenue field in the opportunity can be automatically updated to reflect the total price actually quoted. When a quote is converted to an order, the opportunity is automatically closed as a win and the final revenue amount recorded.

A quote can be associated with the following objects:

  • One or more products and price lists
  • One or more competitors
  • An opportunity
  • A customer
  • One or more notes and attachments
  • One or more customer addresses

A quote can be in one of the following states:

  • Draft
  • Active
  • Won
  • Closed

An order can be in one of the following states:

  • Active
  • Submitted
  • Canceled

An invoice can be in one of the following states:

  • Active
  • Closed

For more general information, see Actions on Objects.


Sales Literature Management

You can create a searchable marketing encyclopedia for storing various sales and marketing literature. As an example, a sales literature library might include:

  • Product information
  • Presentations and brochures
  • Policies and procedures
  • Sales literature
  • White papers
  • Competitive information
  • News articles (Announcements)
  • Price lists
  • Annual reports
  • Manuals
  • The Microsoft CRM application supports a Subject Manager and Knowledge Base.

Definition of Terms

A sales literature item is the basic unit of the marketing encyclopedia. For example, a business unit might choose to have an article about a specific product. That article could contain multiple documents (the brochure, the detailed specifications, and a CAD file) along with appropriate search terms (bolt, ¼", stainless steel). Any PC-compatible file format can be uploaded and attached to an article in the marketing encyclopedia. Specific search terms can be specified for each item.

Classes

The following table describes the classes of the sales literature management objects.

Class | Description
CRMSalesLiterature | Methods to manage the collection of sales literature
CRMSalesLiteratureItem | Methods to manage sales literature items
CRMNewsArticle | Methods to manage news articles (announcements)

Details

You can use the sales literature management objects to create a central repository for organization sales information (in the form of documents) that provides an easy way to distribute information to users, both online and offline. Sales literature can be organized into categories and types to facilitate management and searching.

A Sales Literature object can have one or more sales literature items attached to it in various formats, such as .doc, .pub, and .pdf. An item cannot be shared between sales literature objects.

Sales literature objects can also be attached to competitors and products (both yours and your competitors' objects).

The basic operations supported in the marketing encyclopedia include:

  • Create a sales literature item
  • View a sales literature item
  • Edit a sales literature item
  • Delete a sales literature item
  • Search for a sales literature item
  • Upload a document and attach it to a sales literature item

Sales literature items can be associated with the following objects:

  • Competitors
  • Products
  • A user (the person responsible for answering questions)

For more general information, see Actions on Objects.


E-mail Management

E-mail is often an effective way for a business unit either to get new information to their customers or to solicit new sales opportunities. The e-mail support in Microsoft CRM helps by giving developers and users the ability to create highly customized e-mail marketing for their existing customers. Users can select a subset of existing customers based on customer demographics (such as location, territory, size, and importance) and send customized e-mail based on templates that can be standardized across the business unit or organization.

Definition of Terms

An e-mail template is a pre-created e-mail message with specified data fields that is used to send customized e-mail to a large group of contacts, or to give salespeople and customer service representatives easy access to standard replies to customer e-mail.

Classes

The following table describes the classes of the e-mail objects.

Class | Description
CRMEmail | Microsoft CRM e-mail management functions
CRMEmailTemplate | E-mail Template API functions

Details

E-mail is a critical part of communication between users and their customers. Even more so is the ability to manage e-mail in a way that allows users to effectively manage relationships with their customers.

E-mail objects support the following:

  • Associate e-mail with activities, contacts, or accounts
  • Send, reply, reply all, and forward e-mail
  • Attach files to e-mail
  • E-mail templates, both organization, and personal
  • Delayed delivery time for sending e-mail
  • Save draft e-mail for future editing

For more general information, see Actions on Objects.


Competitor Tracking

With competitor tracking, you can identify competitors and analyze their sales strategies, their products, and what contracts they win. This functionality includes adding and maintaining competitor records, and storing competitor documents. Competitor tracking provides the means to disperse competition information to everyone that deals with an opportunity, so that they can compete in the most effective way possible to close the sale and maintain the relationship. Competitor tracking helps you compare your business unit to the competition, including opportunities lost to and won against competitors.

Definition of Terms

A competitor is another company who offers competing products and services.

Classes

The following table describes the classes of the competitor tracking objects.

Class | Description
CRMCompetitor | Methods to manage competitors

Details

Each competitor record can contain detailed information about the competitor, including a company profile, a SWOT analysis (Strengths, Weaknesses, Opportunities, and Threats), and any relevant sales materials and presentations. In addition, competitor articles can contain links to relevant information in the marketing encyclopedia.

One or many competitors can be associated with any opportunity. By using this association, salespeople give management the ability to track their overall win/loss record versus specific competitors, as well as to do further analysis regarding the cause of losses and other outcomes.

The basic operations supported for competitors are: Create, Edit, Delete, and Read. For more general information, see Actions on Objects.


Synchronization with Microsoft CRM Sales for Outlook

Microsoft CRM Sales for Outlook is a client application that provides the sales force automation and marketing functionality of the Microsoft CRM application within Microsoft Outlook. Microsoft CRM synchronizes a local copy of a user's contacts, tasks, appointments, and e-mail data with Microsoft® Outlook®. With Microsoft CRM Sales for Outlook, users can work online or offline and either within the Microsoft CRM application or within Outlook.

Definition of Terms

Microsoft CRM Sales for Outlook is a client application that provides the sales force automation and marketing functionality of the Microsoft CRM application within Microsoft Outlook. This is also referred to as the Outlook client.

Online is the state of a computer that is connected to the Microsoft CRM server.

Offline is the state of a computer that is disconnected from the Microsoft CRM server.

Classes

The following table describes the classes of the Microsoft CRM Sales for Outlook objects.

Class | Description
CRMRichClientSync | Methods to prepare data for synchronization with Microsoft CRM Sales for Outlook

Details

Microsoft CRM maintains a local store (Microsoft SQL Server™ 2000 Desktop Engine, MSDE) on a user's computer for Microsoft CRM data and does not use the local store in Microsoft Outlook for the Microsoft CRM application storage. Data from the Microsoft CRM server can be synchronized with this local store for offline access to data. In addition, there is two-way synchronization between this local store and Outlook for contact, task, calendar, and e-mail items. The synchronization between MSDE and the Microsoft CRM server uses a queue approach, which replays client-side transactions back to the server. The synchronization from server to MSDE is performed through SQL server replication. In the online state, the client uses the server database and not MSDE.

When you run a synchronization process, Microsoft CRM overwrites existing information without verifying or comparing the "last saved" date. This means if you changed a record a week ago, and someone else changed that same record earlier today, if you synchronize in the afternoon, your changes will overwrite the other person's, even though your changes are older. If, however, you and another user change different data, both changes will be saved. For example, if you have a customer named Jeff Smith and you change his first name to John, and another user changes his last name to Rodman, when you both synchronize your data, the customer's name will be John Rodman.

The following table shows how objects are mapped from Outlook to Microsoft CRM.

Outlook | Microsoft CRM
E-mail | CRM e-mail activity
Task | CRM task activity
Appointment/meeting | CRM appointment activity
Contact | CRM contact
Not applicable | CRM phone call activity, CRM fax activity, CRM letter activity, CRM account, CRM opportunity, CRM lead, and all other Microsoft CRM items


Customer Service Management

The objects described here are targeted at the customer service department of an organization.

The topics covered here are:

  • Contracts . Managing customer agreements.
  • Incident (Case) Management . Managing customer requests for assistance or services.
  • Knowledge Base . Managing a searchable database of documents that provide answers to defined problems. Also, managing a hierarchy of related topics that form the classification of the Knowledge Base.
  • Subjects . Subjects can be thought of as a mechanism for organizing / categorizing objects such as contracts, incidents and the knowledge base.


Contracts

The Contract object is used to track customer service agreements.

Definition of Terms

A contract is an agreement to provide customer service support during specified coverage dates or for a specified number of cases or amount of time. When customers contact customer service, the level of support they receive is determined by their contract.

The contract detail contains a detailed description of what type of service a customer is entitled to. These are referred to as contract lines in the application.

A contract template can be used as a shorthand method for creating standard contracts.

Classes

The following table describes the classes of the contract object.

Class | Description
CRMContract | Methods to manage application contracts
CRMContractDetail | Methods to manage application contract details
CRMContractTemplate | Methods to manage application contract templates

Details

A contract can have one of the following states: Active, Canceled, Draft, Expired, Hold, or Invoiced. For more general information, see Actions on Objects.

There are several time-consuming tasks associated with building a contract. Using templates can shorten this time by creating a nearly complete contract and then transforming it into a specific contract for each contact or account.


Incident (Case) Management

Incident management is the primary aspect of the Customer Service portion of the SDK. The other features, such as the Knowledge Base, are used to help manage cases. In the Microsoft CRM application, an incident is referred to as a case.

Definition of Terms

An incident (case) is a customer service issue, that is, a problem that is defined by a customer and the collection of activities that happen in the case to resolve the problem.

Classes

The following table describes the classes for the incident object.

Class | Description
CRMIncident | Methods to manage incidents (cases)

Details

A customer service representative creates an incident (case) to track a question or a problem. All actions and communications can be tracked in the CRMIncident object. An incident can be in one of three states: Open, Closed or Canceled.

By using Incident management APIs, reports can be created to measure statistics, such as individual customer service representative statistics (call lengths, resolutions, and so on) and the average length of time incidents remain open.

Operations on an incident

The platform supports the ability to track a large number of incidents and activities. Many of these tasks overlap with activities in sales force automation.

Routing and queuing is the process of moving activities and cases from the customer to the proper customer service representative for service request completion. For more information, see Workflow and Rule Management.

The following are the actions that are supported on incidents either directly or indirectly: Attach Note, Attach File, Delete, Share, Reactivate, Resolve, Route, and Assign. For more general information, see Actions on Objects.


Knowledge Base

With the Knowledge Base, you can manage the distribution of product and service information for a business unit. Answers to users' questions can also be stored in the Knowledge Base. The underlying content organization is displayed in the subject tree.

Definition of Terms

The Knowledge Base is a collection of articles with one or more headers. It is searchable by keyword and header text, and also supports a full-text search.

An answer is a set of published content (documents, Knowledge Base articles, URLs, internal objects) that is stored with searchable metadata.

An article is a type of structured content that is managed internally as part of a Knowledge Base.

An article template is a template used to create an article, describing the sections and formatting required for the article.

An article comment captures comments on articles.

Classes

The following table describes the classes for knowledge base objects.

Class | Description
CRMAnswer | Methods to find published articles in the Knowledge Base
CRMArticle | Methods to manage knowledge base articles
CRMArticleComment | Methods to manage comments on articles
CRMArticleTemplate | Methods to manage article templates

Details

The Knowledge Base architecture consists of a metadata-driven repository that makes it possible to link questions to various types of content (such as documents, articles, graphics, and Web pages) as answers. Also supported is a structured Knowledge Base article and template system for rapid creation of Web-based (HTML) answers.

The following are the actions that are supported on article templates, article comments, and subjects: Create, Delete, Update, and Retrieve.

The following are the actions that are supported on articles: Create, Delete, Update, Retrieve, Submit, Reject, Publish, and Unpublish.

The answer object is used to retrieve information stored in the Knowledge Base. The search methods support "like" and "exact match" searches as well as wildcard searches. Searching occurs only within the published articles.

The following are the actions support on answers: Retrieve (by ID), RetrieveByNumber, RetrieveByObject, RetrieveBySubject, SearchByBody, SearchByKewords, and SearchByTitle.

For more general information, see Actions on Objects.


Subjects

The underlying content organization of the Knowledge Base is displayed in the subject tree.

Definition of Terms

A subject is a category used to organize objects, such as articles.

Classes

The following table describes the classes for the subject object.

Class | Description
CRMSubject | Methods to manage subjects

Details

Subjects support the creation of a hierarchy of topics that organizes and maintains information within the system. The information organized in the subject tree can be used by any object in the Microsoft CRM platform. Primarily, the Subject object categorizes the following:

  • Knowledge base articles
  • Incidents (cases)
  • Product catalog items
  • Contracts
  • Sales literature

The subject tree provides organizational consistency across objects, making the system easier for customer service, sales, and marketing to use. Often, the products for an organization determine the subject tree. However, it is possible to use Subject objects to create nodes at the root level that are not shared.

The following are the actions that are supported on subjects: Create, Delete, Update and Retrieve.

For more general information, see Actions on Objects.


Miscellaneous

The objects, licenses, and reporting tools discussed here encompass multiple parts of the Microsoft CRM application.

The topics covered here are:

  • Workflow and Rule Management
  • Customization Objects
  • Reporting


Workflow and Rule Management

In Microsoft CRM, workflow and rule management can be used to set up sales processes and is also used for routing of activities, leads and opportunities.

Definition of Terms

A workflow process is a group of interrelated steps, or actions, and the rules that drive the transition between these steps. This is an encapsulation of an entire business policy or business process. A workflow process may include e-mail, updating objects and other actions.

A process template is a blueprint of a process, which is used to create new processes.

A process instance is a running instance of a process. A process is instantiated either by a system event on its associated object or manually by a user or caller.

An automatic process is a process that is automatically triggered by some event.

A manual process is a process that is manually executed by a user.

A step is a container of actions and rules.

An action is an operation that the workflow system performs after navigating to a step. Some examples are: Create a task, send an e-mail, or change the parent object.

A condition is a parameter to be evaluated to either true or false.

A rule is a collection of conditions and a single transition.

Classes

The following table describes the classes of the workflow and rule management objects.

Class | Description
CRMProcess | Methods to manage workflow process objects
CRMProcessController | Methods to manage workflow process instance objects

Details

The workflow engine is responsible for executing the workflow rules that have been set for the business units. Developers can take advantage of the framework provided by the workflow engine to specify the workflow rules or expose them in such a way so that system administrators can specify their own workflow rules. By using the Workflow Manager tool, system administrators and developers can take advantage of events and actions exposed in this tool to specify their own workflow rules using the graphical user interface that the tool provides.

Routing, a subset of workflow, is the process by which objects get sent to the appropriate users within an organization, based on the properties of that object. The object can either be assigned directly to the appropriate person or assigned to a generally accessible queue that applies to all such users, until one of those users decides to either handle it themselves or assign it to another specific individual. Items can be routed in Microsoft CRM using a set of rules configured by the business unit that will direct specific objects to a queue or individual based upon the properties of that object.

More details on workflow objects can be found in the reference topic Workflow Reference.


Customization Objects

Microsoft CRM allows customization of many different sorts. The Customization object supports access to the string values for drop-down lists (picklists), and status and status reason fields. It also supports transformation of one object into another. This transformation copies the appropriate field values to the new object.

Definition of Terms

A drop-down list (picklist) is a set of valid values for a field.

The status reason field is used on many objects to store the application-specific information. This field is used at the discretion of the application.

Similar to status reason, the status field is used on many objects to store status information. However, this field is used internally by Microsoft CRM and is typically set by methods in the API.

Classes

The following table describes the classes of the customization objects.

Class | Description
CRMCustomization | Methods to manage application customization

Details

The methods RetrievePicklist, RetrieveState, and RetrieveStatus, are used to retrieve the mapping of values to string names for drop-down lists (picklists), status, and status reason fields.

The Transform method is used to create an object from an existing object, copying the field values that are appropriate for the destination object type.


Reporting

The Microsoft CRM application comes with a robust reporting component from Crystal Reports Designer that makes it easy for you to access summarized information from the system and to customize those reports as needed. Using the Crystal Reports Designer engine, there are over 100 standard reports covering every component of the product — from account hierarchy reports to pipeline charts to case management effectiveness reports. These reports are generated from a user's security context (that is, if users cannot see the data in the application, they will not be able to see it in a report), enable filtering (where appropriate), and can be viewed, printed, and exported.

Note If you want to customize these reports, you need to upgrade to Crystal Reports Enterprise Edition.


Application Integration

Application integration describes how to add custom menus, side tabs, and buttons to the Microsoft CRM application and to Microsoft CRM Sales for Outlook (the Outlook client).

To do this, you edit the text-based configuration files found on your Microsoft CRM server.

Note To make your customization look like Microsoft CRM, use the style sheet found in the technical article "Customizing the UI for Third-Party Extensions to Microsoft CRM" at msdn.microsoft.com/library/en-us/dnmbscrm/html/mbs_crmappui.asp.

Any integration into the application must participate in security. That is, any server or client application calling into the Microsoft CRM application programming interface (API) must have user context in the same domain.

Important Any integration into Microsoft CRM Version 1.2 may not be supported in the same way in future versions.

The following topics explain the details of customization:

  • Customizing the Microsoft CRM Application. This topic describes how to customize the application using the configuration file.
  • Customizing Microsoft CRM Sales for Outlook. This topic describes how to customize the Outlook client using the configuration file.
  • URL Addressable Forms. This topic describes how to open any form in Microsoft CRM from an external or integrated application.


Customizing the Microsoft CRM Application

The following sections describe each of the supported Microsoft CRM application integration points:

  • Main navigation pane. You can add side tabs to the navigation pane (on the left) in each module: Home, Workplace, Sales, Service, and Reports.
  • Global menu bar. You can add menus between the GoTo menu and the Help menu in the global menu bar.
  • Detail form menu bar. You can add menus to the left of the Help menu to the following detail forms: Account, Contact, Lead, Opportunity, Incident (Case), Quote, SalesOrder (Order), and Invoice.
  • Detail form toolbar. You can add buttons to the toolbar on the following detail forms: Account, Contact, Lead, Opportunity, Incident (Case), Quote, SalesOrder (Order), and Invoice.
  • Detail form navigation pane. You can add side tabs to the navigation pane (on the left) in the following detail forms: Account, Contact, Lead, Opportunity, Incident (Case), Quote, SalesOrder (Order), and Invoice.

A sample integration file and an XML reference follows.

Integration setup

You can find the XML file for application integration on the Microsoft CRM Web server at:

<installation drive and folder>\wwwroot\_Resources\isv.config

Edit this file to add menus, side tabs, and buttons to your system. Making a copy of the original configuration file before editing is recommended.

The Microsoft CRM application reads this configuration file when the application is started.

Customization file

To enable your customizations, you set the ISVIntegration setting in the web.config file to On. Web.config is located at:

<installation drive and folder>\wwwroot\web.config

The ISVIntegration setting is used as a performance optimization. When there are no customizations to be rendered, the value for this setting should be Off.

Value: On or Off

<add key="ISVIntegration" value="On"/>

Parameter passing

When a user selects a customized menu item, side tab, or button, the specified URL opens. Application-level links open in the same window. Detail form–level links open in a new window. The current object type and object ID are passed as parameters if the PassParams flag is set to 1. (For more information, see the XML Reference topic.)

Security issue

All users of the system have access to all integration points. There are no security or role-based limitations built into the integration; in other words, these customizations are visible to all users regardless of their roles.


Integration into the Main Navigation Pane

You can add side tabs to the main navigation pane (on the left) in each module: Home, Workplace, Sales, Service, and Reports. The first figure shows three side tabs added to the main navigation bar in the Home module (ISV Test 1, ISV Test 2, and ISV Test 3). When a user clicks one of these side tabs, the URL opens in the same window, in the grid area. Each module has a section in the configuration file. For more information, see Areas, Home, Workplace, Sales, Service, and Reports.

Integration into the main navigation pane

Adding a side tab to the navigation pane automatically adds a parallel menu item to the GoTo menu on the global menu bar. These menu items are added into the sub-menu for the appropriate section, at the bottom of the sub-menu. The following figure shows the menu items for the ISV Test side tabs.

Integration into the GoTo menu


Integration into the Global Menu Bar

You can add customized menus to the global menu bar, between the GoTo and Help menus. The following figure shows a customized menu called ISV. When a user clicks one of the menu items, the URL opens in a new window. For more information, see MenuBar and CustomMenus.

Integration into the global menu bar

© 2003 Microsoft Corporation. All rights reserved.


Integration into a Detail Form

You can insert custom menus to the left of the Help menu in the detail forms for the following objects:

  • Account
  • Contact
  • Lead
  • Opportunity
  • Incident (Case)
  • Quote
  • SalesOrder (Order)
  • Invoice

The following figure shows a custom menu called ISV in the detail form for accounts. When a user clicks one of the menu items, the URL opens in a new window. For more information, see MenuBar and CustomMenus.

Integration into a detail form

© 2003 Microsoft Corporation. All rights reserved.


Integration into a Detail Form Toolbar

You can add custom buttons to the toolbar in detail forms. When a user clicks one of these buttons, the URL opens in a new window. The following figure shows two Test buttons on an account detail form. For more information, see ToolBar.

Integration into a detail form toolbar

© 2003 Microsoft Corporation. All rights reserved.


Integration into a Detail Form Navigation Pane

Like the main navigation pane, you can add custom side tabs to the navigation pane in the following detail forms: Account, Contact, Lead, Opportunity, Incident (Case), Quote, SalesOrder (Order), and Invoice. When a user clicks a custom side tab, the URL opens in the grid pane. The following figure shows the ISV Test 1 side tab in an account detail form. For more information, see NavBar.

Integration into a detail form navigation pane

© 2003 Microsoft Corporation. All rights reserved.


Sample Integration

The following is a sample configuration file for application integration. This sample file uses "www.microsoft.com" as an example URL. Replace this URL with the URL appropriate for your customization.

<configuration>

   <Root>
      <!-- The main menu bar located at the top of all root-level areas -->
      <MenuBar>

         <!-- Custom menu bar items that appear between the GoTo menu and the Help menu -->
         <CustomMenus>

            <Menu Title="ISV">
               <MenuItem Title="New Window" Url="http://www.microsoft.com"/>
               <MenuSpacer/>
               <SubMenu Title="ISV Tests">
                  <MenuItem Title="Modeless Dialog" Url="http://www.microsoft.com" WinMode="2"/>
                  <MenuSpacer/>
                  <MenuItem Title="Modal Dialog" Url="http://www.microsoft.com" WinMode="1"/>
               </SubMenu>
            </Menu>

         </CustomMenus>

      </MenuBar>

      <!-- The navigation pane (on the left side) for each section in the application -->
      <Areas>

         <Home code="home">
            <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navIsv1"/>
            <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 2" Url="http://www.microsoft.com" Id="navIsv2"/>
            <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 3" Url="http://www.microsoft.com" Id="navIsv3"/>
         </Home>

         <Workplace code="workplace"/>
         <Sales code="sfa"/>
         <Service code="cs"/>
         <Reports code="reports"/>

      </Areas>

   </Root>

   <!-- Microsoft CRM Entities (objects) -->

   <Entities>

      <account>

         <MenuBar>

            <!-- Custom menus that you can add -->
            <CustomMenus>

               <Menu Title="ISV" ValidForCreate="0" ValidForUpdate="1">
                  <MenuItem Title="Coming Soon..." Url="http://www.microsoft.com" PassParams="0" WinMode="1"/>
                  <MenuSpacer/>
                  <SubMenu Title="Sub Test">
                     <MenuItem Title="Test Sub 1" Url="http://www.microsoft.com" PassParams="1"/>
                     <MenuSpacer/>
                     <MenuItem Title="Test Sub 2"/>
                  </SubMenu>
                  <MenuSpacer/>
                  <MenuItem Title="Coming Soon..." Url="http://www.microsoft.com" PassParams="0"/>
               </Menu>

            </CustomMenus>
         </MenuBar>

         <!-- The account toolbar -->
         <ToolBar ValidForCreate="0" ValidForUpdate="1">

            <Button Title="Test" ToolTip="Info on Test" Icon="/_imgs/ico_18_debug.gif" Url="http://www.microsoft.com" PassParams="1" WinParams="" WinMode="0"/>
            <ToolBarSpacer/>
            <Button Title="Test" ToolTip="Info on Test" Icon="/_imgs/ico_18_debug.gif" Url="http://www.microsoft.com" PassParams="1" WinParams="" WinMode="1"/>

         </ToolBar>

         <!-- The account detail form navigation pane -->
         <NavBar ValidForCreate="0" ValidForUpdate="1">

            <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navItem"/>

         </NavBar>

      </account>

      <contact/>
      <lead/>
      <opportunity/>
      <incident/> <!-- case -->
      <quote/>
      <salesorder/> <!-- order -->
      <invoice/>

   </Entities>

</configuration>


XML Reference

The following table describes the XML Schema definition language (XSD) elements used in the Microsoft CRM Web application.

Element | Description
account | The detail form for the Account object.
Areas | The navigation pane areas for each module in the Microsoft CRM application.
Button | A button on a toolbar.
Configuration | The main element in the configuration file.
contact | The detail form for the Contact object.
CustomMenus | The custom menus to be added to the Microsoft CRM application.
Entities | The set of objects that can be shown in a detail form window.
Home | The Home module in the Microsoft CRM application.
incident | The detail form for the Incident (Case) object.
invoice | The detail form for the Invoice object.
lead | The detail form for the Lead object.
Menu | A new menu to be added to the Microsoft CRM application.
MenuBar | A new menu bar.
MenuItem | An item in a menu.
MenuSpacer | A separator line in a menu.
NavBar | The container for side tabs added to the navigation pane in a detail form window.
NavBarItem | A side tab added to the navigation pane in the main window of the Microsoft CRM application.
opportunity | The detail form for the Opportunity object.
quote | The detail form for the Quote object.
Reports | The Reports module in the Microsoft CRM application.
Root | The container for elements added to the main Microsoft CRM application window.
Sales | The Sales module in the Microsoft CRM application.
salesorder | The detail form for the SalesOrder (Order) object.
Service | The Service module in the Microsoft CRM application.
SubMenu | A sub-menu in a menu.
Toolbar | A toolbar that is added to an object detail form.
ToolbarSpacer | A spacer that is added between toolbar buttons.
Workplace | The Workplace module in the Microsoft CRM application.


account

The detail form for the Account object.

Example

<account>
    <MenuBar>
       <!-- Custom menus that you can add -->
       <CustomMenus>
       </CustomMenus>
    </MenuBar>

    <!-- The account toolbar -->
    <ToolBar ValidForCreate="0" ValidForUpdate="1">
    </ToolBar>

    <!-- The account detail form navigation pane -->
    <NavBar ValidForCreate="0" ValidForUpdate="1">
    </NavBar>

</account>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Entities
Child elements | MenuBar, Toolbar and NavBar


Areas

The navigation pane areas for each module in the Microsoft CRM application.

Example

<!-- The navigation pane (on the left side) for each section in the application -->
<Areas>

    <Home code="home">
       <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navIsv1"/>
    </Home>

    <Workplace code="workplace"/>
    <Sales code="sfa"/>
    <Service code="cs"/>
    <Reports code="reports"/>

</Areas>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Root
Child elements | Home, Workplace, Sales, Service, and Reports


Button

A button on a toolbar.

Example

<Button Title="Test" ToolTip="Info on Test" Icon="/_imgs/ico_18_debug.gif" Url="http://www.microsoft.com" PassParams="1" WinParams="" WinMode="0"/>

Attributes

Title

Specifies the name of the button.

ToolTip

Specifies the ToolTip that appears for the button.

Icon

Specifies the file name of the icon for the button.

Url

Specifies the URL to be opened for the button.

PassParams

[optional] Specifies whether the object type and object ID parameters are to be passed to the URL.

WinParams

Specifies the parameters to be passed to the window. The format of this parameter is different depending on the value of the WinMode parameter.

For WinMode = 0, see the MSDN Library topic "open Method," located at msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp?frame=true.

For WinMode = 1 and 2, see the MSDN Library topic "showModalDialog Method," located at msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp?frame=true.

WinMode

[optional] Specifies the window mode. Values are 0 = Window [default], 1 = Modal Dialog, or 2 = Modeless Dialog.

Element Information

Number of occurrences | One or more
Parent elements | Toolbar
Child elements | None


configuration

The main element in the configuration file.

Example

<configuration>
   <Root>
   </Root>
   <Entities>
   </Entities>
</configuration>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | None
Child elements | Root and Entities


contact

The detail form for the Contact object.

Example

<contact>
    <MenuBar>
       <!-- Custom menus that you can add -->
       <CustomMenus>
       </CustomMenus>
    </MenuBar>

    <!-- The contact toolbar -->
    <ToolBar ValidForCreate="0" ValidForUpdate="1">
    </ToolBar>

    <!-- The contact detail form navigation pane -->
    <NavBar ValidForCreate="0" ValidForUpdate="1">
    </NavBar>
</contact>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Entities
Child elements | MenuBar, Toolbar, and NavBar


CustomMenus

The custom menus to be added to the Microsoft CRM application.

Example

<CustomMenus>
   <Menu Title="ISV" ValidForCreate="0" ValidForUpdate="1">
        <MenuItem Title="Coming Soon..." Url="http://www.microsoft.com" PassParams="0" WinMode="1"/>
        <MenuSpacer/>
        <SubMenu Title="Sub Test">
             <MenuItem Title="Test Sub 1" Url="http://www.microsoft.com" PassParams="1"/>
        </SubMenu>
   </Menu>
</CustomMenus>

Attributes

None

Element Information

Number of occurrences | One per parent element
Parent elements | MenuBar
Child elements | Menu


Entities

The set of objects that can be shown in a detail form window.

Example

<Entities>
   <account/>
   <contact/>
   <lead/>
   <opportunity/>
   <incident/>
   <quote/>
   <salesorder/>
   <invoice/>
</Entities>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Configuration
Child elements | account, contact, lead, opportunity, incident, quote, salesorder, and invoice


Home

The Home module in the Microsoft CRM application.

Example

<Home>
   <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navIsv1"/>
</Home>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Areas
Child elements | Zero or more of NavBarItem


incident

The detail form for the Incident (Case) object.

Example

<incident>
    <MenuBar>
       <!-- Custom menus that you can add -->
       <CustomMenus>
       </CustomMenus>
    </MenuBar>

    <!-- The incident (case) toolbar -->
    <ToolBar ValidForCreate="0" ValidForUpdate="1">
    </ToolBar>

    <!-- The incident (case) detail form navigation pane -->
    <NavBar ValidForCreate="0" ValidForUpdate="1">
    </NavBar>
</incident>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Entities
Child elements | MenuBar, Toolbar, and NavBar


invoice

The detail form for the Invoice object.

Example

<invoice>
    <MenuBar>
       <!-- Custom menus that you can add -->
       <CustomMenus>
       </CustomMenus>
    </MenuBar>

    <!-- The invoice toolbar -->
    <ToolBar ValidForCreate="0" ValidForUpdate="1">
    </ToolBar>

    <!-- The invoice detail form navigation pane -->
    <NavBar ValidForCreate="0" ValidForUpdate="1">
    </NavBar>

</invoice>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Entities
Child elements | MenuBar, Toolbar, and NavBar


lead

The detail form for the Lead object.

Example

<lead>
    <MenuBar>
       <!-- Custom menus that you can add -->
       <CustomMenus>
       </CustomMenus>
    </MenuBar>

    <!-- The lead toolbar -->
    <ToolBar ValidForCreate="0" ValidForUpdate="1">
    </ToolBar>

    <!-- The lead detail form navigation pane -->
    <NavBar ValidForCreate="0" ValidForUpdate="1">
    </NavBar>

</lead>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Entities
Child elements | MenuBar, Toolbar, and NavBar


Menu

A new menu to be added to the Microsoft CRM application.

Example

<Menu Title="ISV">
   <MenuItem Title="New Window" Url="http://www.microsoft.com"/>
   <MenuSpacer/>
   <SubMenu Title="ISV Tests">
   </SubMenu>
</Menu>

Attributes

Title
Specifies the title of the menu.
ValidForCreate
Specifies whether the toolbar should be shown in the detail form window when an object is being created.
ValidForUpdate
Specifies whether the toolbar should be shown in the detail form window when an object is being updated.

Element Information

Number of occurrences | One per parent section
Parent elements | CustomMenus
Child elements | One or more MenuItem, MenuSpacer, or SubMenu elements


MenuBar

A new menu bar.

Example

<MenuBar>
   <CustomMenus>
   </CustomMenus>
</MenuBar>

Attributes

None

Element Information

Number of occurrences | One per parent element
Parent elements | Root, account, contact, lead, opportunity, incident, quote, salesorder, or invoice
Child elements | CustomMenus


MenuItem

An item in a menu.

Example

<MenuItem Title="New Window" Url="http://www.microsoft.com"/>

Attributes

Title
[required] Specifies the name of the menu item.
Url
[required] Specifies the URL to be opened when the menu item is selected.
WinMode
[optional] Specifies the window mode. Values are 0 = Window [default], 1 = Modal Dialog, or 2 = Modeless Dialog.
PassParams
[optional] Specifies whether the object type and object ID parameters are to be passed to the URL.

Element Information

Number of occurrences | Zero or more per parent element
Parent elements | Menu or SubMenu
Child elements | None


MenuSpacer

A separator line in a menu.

Example

<MenuSpacer/>

Attributes

None

Element Information

Number of occurrences | Zero or more per parent element
Parent elements | Menu or SubMenu
Child elements | None


NavBar

The container for side tabs added to the navigation pane in a detail form window.

Example

<NavBar ValidForCreate="0" ValidForUpdate="1">
   <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navItem"/>
</NavBar>

Attributes

Icon
Specifies the file name icon to be displayed on the side tab.
Title
Specifies the name of the side tab.
ValidForCreate
Specifies whether the toolbar should be shown in the detail form window when an object is being created.
ValidForUpdate
Specifies whether the toolbar should be shown in the detail form window when an object is being updated.

Element Information

Number of occurrences | Zero or more per parent element
Parent elements | account, contact, lead, opportunity, incident, quote, salesorder, or invoice
Child elements | Zero or more of NavBarItem


NavBarItem

A side tab added to the navigation pane in the main window of the Microsoft CRM application

Example

   <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navIsv1"/>

Attributes

Icon
Specifies the file name icon to be displayed on the side tab.
Title
Specifies the name of the side tab.
Url
Specifies the URL to be opened.
Id
Specifies the ID of the side tab.

Element Information

Number of occurrences | Zero or more per parent element
Parent elements | Home, Workplace, Sales, Service, or Reports
Child elements | None


opportunity

The detail form for the Opportunity object.

Example

<opportunity>
    <MenuBar>
       <!-- Custom menus that you can add -->
       <CustomMenus>
       </CustomMenus>
    </MenuBar>

    <!-- The opportunity toolbar -->
    <ToolBar ValidForCreate="0" ValidForUpdate="1">
    </ToolBar>

    <!-- The opportunity detail form navigation pane -->
    <NavBar ValidForCreate="0" ValidForUpdate="1">
    </NavBar>

</opportunity>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Entities
Child elements | MenuBar, Toolbar, and NavBar


quote

The detail form for the Quote object.

Example

<quote>
    <MenuBar>
       <!-- Custom menus that you can add -->
       <CustomMenus>
       </CustomMenus>
    </MenuBar>

    <!-- The quote toolbar -->
    <ToolBar ValidForCreate="0" ValidForUpdate="1">
    </ToolBar>

    <!-- The quote detail form navigation pane -->
    <NavBar ValidForCreate="0" ValidForUpdate="1">
    </NavBar>

</quote>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Entities
Child elements | MenuBar, Toolbar, and NavBar


Reports

The Reports module in the Microsoft CRM application.

Example

<Reports>
   <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navIsv1"/>
</Reports>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Areas
Child elements | Zero or more of NavBarItem


Root

The container for elements added to the main Microsoft CRM application window.

Example

<Root>
   <MenuBar>
   </MenuBar>
   <Areas>
   </Areas>
</Root>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Configuration
Child elements | MenuBar and Areas


Sales

The Sales module in the Microsoft CRM application.

Example

<Sales>
   <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navIsv1"/>
</Sales>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Areas
Child elements | Zero or more of NavBarItem


salesorder

The detail form for the SalesOrder (Order) object.

Example

<salesorder>
    <MenuBar>
       <!-- Custom menus that you can add -->
       <CustomMenus>
       </CustomMenus>
    </MenuBar>

    <!-- The salesorder (order) toolbar -->
    <ToolBar ValidForCreate="0" ValidForUpdate="1">
    </ToolBar>

    <!-- The salesorder (order) detail form navigation pane -->
    <NavBar ValidForCreate="0" ValidForUpdate="1">
    </NavBar>

</salesorder>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Entities
Child elements | MenuBar, Toolbar, and NavBar


Service

The Service module in the Microsoft CRM application.

Example

<Service>
   <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navIsv1"/>
</Service>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Areas
Child elements | Zero or more of NavBarItem


SubMenu

A sub-menu in a menu.

Example

<SubMenu Title="ISV Tests">
   <MenuItem Title="Modeless Dialog" Url="http://www.microsoft.com"/>
   <MenuSpacer/>
   <MenuItem Title="Modal Dialog" Url="http://www.microsoft.com" WinMode="1"/>
</SubMenu>

Attributes

Title
Specifies the name of the sub-menu.

Element Information

Number of occurrences | Zero or more per parent element
Parent elements | Menu
Child elements | MenuItem or MenuSpacer


Toolbar

A toolbar that is added to an object detail form.

Example

<ToolBar ValidForCreate="0" ValidForUpdate="1">
   <Button Title="Test" ToolTip="Info on Test"
        Icon="/_imgs/ico_18_debug.gif"
        Url="http://www.microsoft.com"
        PassParams="1" WinParams="" WinMode="0"/>
   <ToolBarSpacer/>
   <Button Title="Test" ToolTip="Info on Test"
        Icon="/_imgs/ico_18_debug.gif"
        Url="http://www.microsoft.com"
        PassParams="1" WinParams="" WinMode="1"/>
</ToolBar>

Attributes

ValidForCreate
Specifies whether the toolbar should be shown in the detail form window when an object is being created.
ValidForUpdate
Specifies whether the toolbar should be shown in the detail form window when an object is being updated.

Element Information

Number of occurrences | One
Parent elements | account, contact, lead, opportunity, incident, quote, salesorder, or invoice
Child elements | Zero or more of Button and/or ToolbarSpacer


ToolbarSpacer

A spacer that is added between toolbar buttons.

Example

<ToolBarSpacer/>

Attributes

None

Element Information

Number of occurrences | Zero or more per parent element
Parent elements | ToolBar
Child elements | None


Workplace

The Workplace module in the Microsoft CRM application.

Example

<Workplace>
   <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navIsv1"/>
</Workplace>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Areas
Child elements | Zero or more of NavBarItem


Customizing Microsoft CRM Sales for Outlook

You can easily customize Microsoft CRM Sales for Outlook (the Outlook client) by adding menus, side tabs, and buttons, which are available in both Offline and Online modes. To do this, you add a text-based configuration file to your Microsoft CRM server.

Any integration into the Web application must participate in security. That is, any server or client application calling into the Microsoft CRM application programming interface (API) must have user context in the same domain. For more information, see the Microsoft CRM SDK Security Model topics.

Important Any integration into Microsoft CRM Version 1.2 may not be supported in the same way in future versions.

The following topics are covered here:

  • Customizing the Outlook Client
  • XML Reference


Customizing the Outlook Client

The following list describes each of the supported Microsoft CRM Sales for Outlook (the Outlook client) integration points:

  • Global menu bar. You can add menus between the Tools and Help menus on the global menu bar for the Outlook client. When a user clicks a menu item on one of these menus, the URL opens in a new window or dialog box. For more information, see MenuBar and CustomMenus.
  • Detail form menu bar. You can add menus between the Actions and Help menus on the following detail forms: Account, Contact, Lead, Opportunity, Quote, SalesOrder (Order), and Invoice. When a user clicks a menu item on one of these menus, the URL opens in a new window. For more information, see MenuBar and CustomMenus.
  • Detail form toolbar. You can add buttons to the toolbar on the following detail forms: Account, Contact, Incident (Case), Invoice, Lead, Opportunity, Quote, and SalesOrder (Order). When a user clicks one of these buttons, the URL opens in a new window. For more information, see ToolBar.
  • Detail form navigation pane. You can add side tabs to the navigation pane (on the left side) on the following detail forms: Account, Contact, Incident (Case), Invoice, Lead, Opportunity, Quote, and SalesOrder (Order). When a user clicks one of these side tabs, the URL opens in the view pane. For more information, see NavBar.

Note Although the Outlook client does not include a menu for Incidents (Cases), you can access them (as read-only forms) through other detail forms, such as the Account detail form.

Related Topics

  • Sample Integration
  • XML Reference


Integration Setup

The configuration file for Microsoft® CRM Sales for Outlook integration is very similar to the one used for Microsoft CRM Web application integration. You can customize the Outlook client by making your changes to the Microsoft CRM application integration file, named isv.config. To use this file, you need to:

  1. Locate the XML file for integration on the Microsoft CRM Web server at:

    <installation drive and folder>\wwwroot\_Resources\isv.config

  2. Make a copy of this file in the same location and rename the new file OutlookClient.xml.
  3. Edit this file to add menus, side tabs, and buttons to your system. Making a copy of the original configuration file before editing is recommended.

Note Outlook client integration does not support the following tags that are available in application integration: Areas, Home, Reports, Sales, Service, and Workplace. These tags are ignored if they are found in OutlookClient.xml.

The Outlook client reads this configuration file when the application is started. Removing the OutlookClient.xml configuration file from the Microsoft CRM Web server removes it from all Microsoft CRM–enabled Outlook client computers when Microsoft Outlook® is restarted on those computers.

Deploying images to Outlook client computers

Image files referenced in the configuration file must be copied to each computer running the Outlook client. One default image (ico_18_debug.gif) is installed with the Outlook client. This image is located in the folder <installation drive and folder>\Client\1033\Web\_imgs>.

Parameter passing

When a user selects a customized menu item, side tab, or button, the specified URL is opened. Most links are opened in a new window with the exception of the navigation bar side tabs. The current object type and object ID are passed as parameters if the PassParams flag is set to 1. (For more information, see the XML Reference topic.)

Security issue

All users of the system have access to all integration points. There are no security or role-based limitations built into the integration; in other words, these customizations are visible to all users regardless of their roles.


Sample Integration

The following is a sample configuration file for Outlook client integration. This sample file uses "www.microsoft.com" as an example URL. Replace this URL with the URL appropriate for your customization.

<configuration>

   <Root>
      <!-- The main menu bar located at the top of the Outlook client -->
      <MenuBar>

         <!-- Custom menu bar items that appear between the Tools and Help menus -->
         <CustomMenus>

            <Menu Title="ISV">
               <MenuItem Title="New Window" Url="http://www.microsoft.com"/>
               <MenuSpacer/>
               <SubMenu Title="ISV Tests">
                  <MenuItem Title="Modeless Dialog" Url="http://www.microsoft.com" WinMode="2"/>
                  <MenuSpacer/>
                  <MenuItem Title="Modal Dialog" Url="http://www.microsoft.com" WinMode="1"/>
               </SubMenu>
            </Menu>

         </CustomMenus>

      </MenuBar>

   </Root>

   <!-- Microsoft CRM Entities (objects) -->

   <Entities>

      <account>

         <MenuBar>

            <!-- Custom menus that you can add -->
            <CustomMenus>

               <Menu Title="ISV" ValidForCreate="0" ValidForUpdate="1">
                  <MenuItem Title="Coming Soon..." Url="http://www.microsoft.com" PassParams="0" WinMode="1"/>
                  <MenuSpacer/>
                  <SubMenu Title="Sub Test">
                     <MenuItem Title="Test Sub 1" Url="http://www.microsoft.com" PassParams="1"/>
                     <MenuSpacer/>
                     <MenuItem Title="Test Sub 2"/>
                  </SubMenu>
                  <MenuSpacer/>
                  <MenuItem Title="Coming Soon..." Url="http://www.microsoft.com" PassParams="0"/>
               </Menu>

            </CustomMenus>
         </MenuBar>

         <!-- The account toolbar -->
         <ToolBar ValidForCreate="0" ValidForUpdate="1">

            <Button Title="Test" ToolTip="Info on Test" Icon="/_imgs/ico_18_debug.gif" Url="http://www.microsoft.com" PassParams="1" WinParams="" WinMode="0"/>
            <ToolBarSpacer/>
            <Button Title="Test" ToolTip="Info on Test" Icon="/_imgs/ico_18_debug.gif" Url="http://investor.microsoft.com" PassParams="1" WinParams="" WinMode="1"/>

         </ToolBar>

         <!-- The account detail form navigation pane -->
         <NavBar ValidForCreate="0" ValidForUpdate="1">

            <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navItem"/>

         </NavBar>

      </account>

      <contact/>
      <incident/> <!—- case -->
      <invoice/>
      <lead/>
      <opportunity/>
      <quote/>
      <salesorder/> <!-- order -->

   </Entities>

</configuration>


XML Reference

The following table describes the XML Schema definition language (XSD) elements used in the Microsoft CRM Sales for Outlook configuration file.

Element | Description
account | The detail form for the Account object.
Button | A button on a toolbar.
Configuration | The main element in an independent software vendor (ISV) configuration file.
contact | The detail form for the Contact object.
CustomMenus | The custom menus to be added to Microsoft CRM Sales for Outlook (the Outlook client).
Entities | The set of objects that can be shown in a detail form window.
incident | The detail form for the Incident (Case) object.
invoice | The detail form for the Invoice object.
lead | The detail form for the Lead object.
Menu | A new menu to be added to the Outlook client.
MenuBar | A new menu bar.
MenuItem | An item in a menu.
MenuSpacer | A separator line in a menu.
NavBar | The container for side tabs added to the navigation pane in a detail form window.
NavBarItem | A side tab added to the navigation pane in a detail form window.
opportunity | The detail form for the Opportunity object.
quote | The detail form for the Quote object.
Root | The container for elements added to the Outlook client.
salesorder | The detail form for the SalesOrder (Order) object.
SubMenu | A sub-menu in a menu.
Toolbar | A toolbar that is added to a detail form.
ToolbarSpacer | A spacer that is added between toolbar buttons.


account

The detail form for the Account object.

Example

<account>
    <MenuBar>
       <!-- Custom menus that you can add -->
       <CustomMenus>
       </CustomMenus>
    </MenuBar>

    <!-- The account toolbar -->
    <ToolBar ValidForCreate="0" ValidForUpdate="1">
    </ToolBar>

    <!-- The account detail form navigation pane -->
    <NavBar ValidForCreate="0" ValidForUpdate="1">
    </NavBar>

</account>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Entities
Child elements | MenuBar, Toolbar, and NavBar


CustomMenus

The custom menus to be added to the Outlook client.

Example

<CustomMenus>
   <Menu Title="ISV" ValidForCreate="0" ValidForRetrieve="1">
        <MenuItem Title="Coming Soon..." Url="http://www.microsoft.com" PassParams="0" WinMode="1"/>
        <MenuSpacer/>
        <SubMenu Title="Sub Test">
             <MenuItem Title="Test Sub 1" Url="http://www.microsoft.com" PassParams="1"/>
        </SubMenu>
   </Menu>
</CustomMenus>

Attributes

None

Element Information

Number of occurrences | One per parent element
Parent elements | MenuBar
Child elements | Menu


Entities

The set of objects that can be shown in a detail form window.

Example

<Entities>
   <account/>
   <contact/>
   <lead/>
   <incident/>
   <invoice/>
   <opportunity/>
   <quote/>
   <salesorder/>
</Entities>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Configuration
Child elements | Account, contact, incident, invoice, lead, opportunity, quote, and salesorder


Menu

A new menu to be added to the application.

Example

<Menu Title="ISV">
   <MenuItem Title="New Window" Url="http://www.microsoft.com"/>
   <MenuSpacer/>
   <SubMenu Title="ISV Tests">
   </SubMenu>
</Menu>

Attributes

Title
Specifies the title of the menu.

Element Information

Number of occurrences | One per parent section
Parent elements | CustomMenus
Child elements | One or more MenuItem, MenuSpacer, or SubMenu elements


MenuBar

A new menu bar.

Example

<MenuBar>
   <CustomMenus>
   </CustomMenus>
</MenuBar>

Attributes

None

Element Information

Number of occurrences | One per parent element
Parent elements | Root, account, contact, incident, invoice, lead, opportunity, quote, or salesorder
Child elements | CustomMenus


MenuItem

An item in a menu.

Example

<MenuItem Title="New Window" Url="http://www.microsoft.com"/>

Attributes

Title
[required] Specifies the name of the menu item.
Url
[required] Specifies the URL to be opened when the menu item is selected.
WinMode
[optional] Specifies the window mode. Values are 0 = Window [default], 1 = Modal Dialog, or 2 = Modeless Dialog.
PassParams
[optional] Specifies whether the object type and object ID parameters are to be passed to the URL. Values are 0 = No [default], 1 = Yes.
WinParams
[optional] Specifies an arbitrary string parameter.

Element Information

Number of occurrences | Zero or more per parent element
Parent elements | Menu or SubMenu
Child elements | None


NavBar

The container for side tabs added to the navigation pane in the detail form window of the Outlook client.

Example

<NavBar ValidForCreate="0" ValidForUpdate="1">
   <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navItem"/>
</NavBar>

Attributes

Icon
Specifies the file name icon to be displayed on the side tab.
Title
Specifies the name of the side tab.

Element Information

Number of occurrences | Zero or more per parent element
Parent elements | Account, contact, incident, invoice, lead, opportunity, quote, or salesorder
Child elements | Zero or more of NavBarItem


NavBarItem

A side tab added to the navigation pane in the detail form window.

Example

   <NavBarItem Icon="/_imgs/ico_18_debug.gif" Title="ISV Test 1" Url="http://www.microsoft.com" Id="navIsv1"/>

Attributes

Icon
Specifies the file name icon to be displayed in the side tab.
Title
Specifies the name of the side tab.
Url
Specifies the URL to be opened for the side tab.
Id
Specifies the ID of the side tab. This must be a unique value within the OutlookClient.xml file.

Element Information

Number of occurrences | Zero or more per parent element
Parent elements | NavBar
Child elements | None


Root

The container for elements add to the Outlook client.

Example

<Root>
   <MenuBar>
   </MenuBar>
</Root>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Configuration
Child elements | MenuBar


salesorder

The detail form for the Salesorder (Order) object.

Example

<salesorder>
    <MenuBar>
       <!-- Custom menus that you can add -->
       <CustomMenus>
       </CustomMenus>
    </MenuBar>

    <!-- The salesorder (order) toolbar -->
    <ToolBar ValidForCreate="0" ValidForUpdate="1">
    </ToolBar>

    <!-- The salesorder (order) detail form navigation pane -->
    <NavBar ValidForCreate="0" ValidForUpdate="1">
    </NavBar>

</salesorder>

Attributes

None

Element Information

Number of occurrences | One
Parent elements | Entities
Child elements | MenuBar, Toolbar, and NavBar


Toolbar

A toolbar that is added to a detail form.

Example

<ToolBar ValidForCreate="0" ValidForUpdate="1">
   <Button Title="Test" ToolTip="Info on Test"
        Icon="/_imgs/ico_18_debug.gif"
        Url="http://www.microsoft.com"
        PassParams="1" WinParams="" WinMode="0"/>
   <ToolBarSpacer/>
   <Button Title="Test" ToolTip="Info on Test"
        Icon="/_imgs/ico_18_debug.gif"
        Url="http://www.microsoft.com"
        PassParams="1" WinParams="" WinMode="1"/>
</ToolBar>

Attributes

ValidForCreate
Specifies whether the toolbar should be shown in the detail form window when an object is being created.
ValidForUpdate
Specifies whether the toolbar should be shown in the detail form window when an object is being updated.

Element Information

Number of occurrences | One
Parent elements | Account, contact, incident, invoice, lead, opportunity, quote, or salesorder
Child elements | Zero or more of Button and/or ToolbarSpacer


URL Addressable Forms

Each form in the Microsoft CRM application is a Web page that can is identified by a unique URL address. This results in a window opening with the specified form.

Example

To open a create form:

http://<server name>/SFA/accts/edit.aspx

To open an edit form, the object ID is specified:

http://<server name>/SFA/accts/edit.aspx?id={1F8B6FC0-426A-4122-BAC2-A05B6071FC57}

The following table lists the URLs for the most common Microsoft CRM objects.

Object | URL
Account | http://<server name>/SFA/accts/edit.aspx
Activity | http://<server name>/Activities/Task/edit.aspx http://<server name>/Activities/Phone/edit.aspx http://<server name>/Activities/Email/edit.aspx http://<server name>/Activities/Letter/edit.aspx http://<server name>/Activities/Fax/edit.aspx http://<server name>/Activities/Appointment/edit.aspx
Announcement | http://<server name>/tools/newseditor/edit.aspx
Business Unit | http://<server name>/biz/business/edit.aspx
Case | http://<server name>/CS/cases/edit.aspx
Competitor | http://<server name>/SFA/comps/edit.aspx
Contact | http://<server name>/SFA/conts/edit.aspx
Contract Template | http://<server name>/Tools/contracttypemanager/edit.aspx
Contract | http://<server name>/CS/contracts/edit.aspx
E-mail Template | http://<server name>/Tools/EmailTemplateEditor/emailtemplateeditor.aspx
Invoice | http://<server name>/SFA/invoice/edit.aspx
Knowledge Base Article | http://<server name>/CS/articles/edit_article.aspx
Knowledge Base Template | http://<server name>/Tools/KbTemplateEditor/kbtemplateeditor.aspx
Lead | http://<server name>/SFA/leads/edit.aspx
Opportunity | http://<server name>/SFA/opps/edit.aspx
Order | http://<server name>/SFA/salesorder/edit.aspx
Product | http://<server name>/Products/Product/edit.aspx
Queue | http://<server name>/Tools/queuingmanager/edit.aspx
Quote | http://<server name>/SFA/quotes/edit.aspx
Role | http://<server name>/biz/roles/edit.aspx
Sales Literature | http://<server name>/SFA/saleslit/edit.aspx
Team | http://<server name>/biz/teams/edit.aspx
Territory | http://<server name>/biz/territories/edit.aspx
User | http://<server name>/biz/users/edit.aspx


Microsoft CRM Data Migration

This section describes the schema of the Common Data Format (CDF) database that is used to prepare data for migration to Microsoft Business Solutions CRM. This information can be used to create source adapters for specific source databases.

The Microsoft Business Solutions CRM Data Migration Framework provides the CDF database and the tools for migrating data from the CDF database to Microsoft CRM. The following diagram shows how the Microsoft CRM Data Migration Framework works with custom source adapters. In order to use a custom source adapter to migrate data, you must have Microsoft CRM and the Microsoft CRM Data Migration Framework installed, and you must initialize the CDF database with data from Microsoft CRM.

This section contains the following topics:

  • Data That Can Be Migrated
  • CDF Database Structure
    • Entity Tables
    • Metadata Tables
    • Microsoft CRM Correlation Tables
  • Data Requirements for Migration
  • ObjectTypeCode Values
  • State and Status Code Values

For additional information about data migration, such as planning data migration, using stored procedures for data cleansing, and controlling the data migration process, see the Microsoft Business Solutions CRM Data Migration Framework Guide and the Detailed Data Planning spreadsheets, which are part of the Microsoft CRM Data Migration Framework documentation.


Data That Can Be Migrated

Data in the following objects can be migrated to Microsoft CRM by using the Microsoft CRM Data Migration Framework. For information about how each entity is migrated, see the CDF Database Entity Tables.

Microsoft CRM entity | Microsoft CRM forms | Customizable in Microsoft CRM?
Account | Account | Yes
Activity | Activity Includes ActivityParty records. An ActivityParty record stores the names in To, From, Cc, Bcc, Call Initiator, Call Recipient, Sender, and Recipient attributes, along with the subject of the activity. There can be many ActivityParty records associated with each Activity. | No
Annotation | Notes side tab on Activity, Lead, Opportunity, Contact, Account, Competitor, Product, Quote, Order, Invoice, and Incident forms File attachments associated with notes cannot be migrated. | No
Competitor | Competitor | Yes
Contact | Contact | Yes
CustomerAddress | More Addresses side tab on Account and Contact forms | Yes
Discount | Discount | No
DiscountType | Discount List | No
Incident | Cases | Yes
Invoice | Invoices | Yes
InvoiceDetail | Products side tab on Invoice form | Yes
Lead | Lead | Yes
Opportunity | Opportunity | Yes
OpportunityProduct | Products side tab on Opportunity form | Yes
PriceLevel | Price List | No
Product | Product | Yes
ProductPriceLevel | Price List Item | No
Quote | Quotes | Yes
QuoteDetail | Products side tab on Quote form | Yes
SalesOrder | Orders | Yes
SalesOrderDetail | Products side tab on Order form | Yes
Subject | Subject Manager | No
UoM | Unit | No
UoMSchedule | Unit Group | No


CDF Database Structure

The CDF database is a Microsoft SQL Server™ 2000 database named cdf_mscrm.

There are three types of tables in the CDF database:

  • Entity tables: These tables will contain the data from your source system. For each entity that can be migrated to Microsoft CRM, the CDF database has two or three entity tables:
    • One entity table for the customer data that is to be entered in the standard Microsoft CRM fields (cdf_<entity>)
    • One entity table for migration information (cdf_<entity>_info)
    • For customizable entities, one entity table for the data that is to be migrated to custom fields in Microsoft CRM (cdf_<entity>_ext)
  • Microsoft CRM correlation tables. These tables are used to correlate the data you load into the entity tables with data in Microsoft CRM. The correlation tables are populated when you run the CDF Initialization Tool, a tool provided in the Microsoft CRM Data Migration Framework. All data in your entity tables that references users, organizations, business units, territories, and drop-down list values must be transformed or cleansed to match the data in these correlation tables.
  • CDF metadata tables. The metadata tables are pre-populated as part of the CDF database setup and do not store your source data. You define criteria for the migration process, such as the size of test batches and whether an entity or attribute should be migrated. The CDF Migration Tool, a tool provided in the Microsoft CRM Data Migration Framework, uses these tables to control the migration process.

The database also includes stored procedures for cleansing data and controlling the data migration process. For more information about the CDF database stored procedures, see Appendix A, "CDF Database Stored Procedures," in the Microsoft Business Solutions CRM Data Migration Framework Guide.

Important Other than adding columns to the cdf_<entity> and cdf_<entity>_ext entity tables, do not change the schema of the CDF database, otherwise migration could fail.


CDF Database Entity Tables

The entity tables in the CDF database consist of three types:

  • Entity base tables (cdf_<entity>), which store your data for the entities you are migrating.
  • Entity information tables (cdf_<entity>_info), which define migration information for the entities.
  • Entity extension tables (cdf_<entity>_ext), which store attributes associated with customizable entities.

The following is a list of all entity base tables in the CDF database. To see the specific schema information for each table, click the appropriate link.

Entity base tables in the CDF database
cdf_Account | cdf_Opportunity
cdf_Activity | cdf_OpportunityProduct
cdf_ActivityParty | cdf_PriceLevel
cdf_Annotation | cdf_Product
cdf_Competitor | cdf_ProductPriceLevel
cdf_Contact | cdf_Quote
cdf_CustomerAddress | cdf_QuoteDetail
cdf_Discount | cdf_SalesOrder
cdf_DiscountType | cdf_SalesOrderDetail
cdf_Incident | cdf_Subject
cdf_Invoice | cdf_UoM
cdf_InvoiceDetail | cdf_UoMSchedule
cdf_Lead |


Entity Base Table (cdf_<entity>) Fields

The entity base table (cdf_<entity>) is used to store your data for the entity you are migrating. Each record in the entity base table has a field for each attribute that can be migrated to the associated Microsoft CRM entity. This includes all optional Microsoft CRM attributes that, by default, are not on the standard Microsoft CRM forms for the entity.

To make it easier to cleanse your data so that it meets Microsoft CRM requirements, the entity base table includes a string attribute as well as an integer attribute for storing your data for identifier and drop-down list attributes. The integer attribute stores the data that is to be migrated; the string attribute stores the string associated with the integer.

  • All <entity>Id attributes are integers, and each has an associated <entity>IdName string attribute.
  • All <drop-down list>Code attributes are integers, and each has an associated <drop-down list>CodeName string attribute.

For a list of the attributes in each cdf_<entity> table, see CDF Database Entity Tables.

Each attribute in each entity base table has an associated record in the cdf_EntityAttribute table, which is one of the CDF metadata tables. Only those attributes listed in the cdf_EntityAttribute metadata table are migrated, which means that you can create your own additional columns in the entity base tables for tracking information about cleansing data and removing duplicates.


cdf_Account Table

Data in the cdf_Account table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Account table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Account attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab names and attribute labels | CDF attribute name | CDF type | Whether Required or Relationship in CDF | Valid Microsoft CRM values | Default Microsoft CRM value
Not on tab | AccountId | int (PK) | Required |  |
 | StateCode1 | int (state) |  | 0 (Active) 1 (Inactive) | 0
Parent Account | ParentAccountId | int | Relationship |  |
 | ParentAccountIdName2 | nvarchar (160) |  |  |
General tab |  |  |  |  |
Account Name | Name | nvarchar (160) |  |  |
Account Number | AccountNumber | nvarchar (20) |  |  |
Primary Contact | PrimaryContactId | int | Relationship |  |
 | PrimaryContactName2 | nvarchar (200) |  |  |
Relationship Type | CustomerTypeCode | int (picklist) |  |  |
 | CustomerTypeCodeName2 | nvarchar (200) (picklist) |  | Competitor Consultant Customer Investor Partner Influencer Press Prospect Reseller Supplier Vendor Other | Null
Main Phone | Telephone1 | nvarchar (50) |  |  |
Other Phone | Telephone2 | nvarchar (50) |  |  |
Fax | Fax | nvarchar (50) |  |  |
Web Site | WebSiteURL | nvarchar (200) |  |  |
E-mail | EmailAddress1 | nvarchar (100) |  |  |
Address Name | Address1_Name | nvarchar (200) |  |  |
Street 1 | Address1_Line1 | nvarchar (50) |  |  |
Street 2 | Address1_Line2 | nvarchar (50) |  |  |
Street 3 | Address1_Line3 | nvarchar (50) |  |  |
City | Address1_City | nvarchar (50) |  |  |
State/Province | Address1_StateOrProvince | nvarchar (50) |  |  |
ZIP/Postal Code | Address1_PostalCode | nvarchar (20) |  |  |
Country/Region | Address1_Country | nvarchar (50) |  |  |
Phone | Address1_Telephone1 | nvarchar (50) |  |  |
Address Type | Address1_AdddressTypeCode | int (picklist) |  |  |
 | Address1_AddressTypeCodeName2 | nvarchar (200) (picklist) |  | Bill To Ship To Primary Other | Null
Shipping Method | Address1_ShippingMethodCode | int (picklist) |  |  |
 | Address1_ShippingMethodCodeName2 | nvarchar (200) (picklist) |  | Airborne DHL FedEx UPS Postal Mail Full Load Will Call | Null
Freight Terms | Address1_FreightTermsCode | int (picklist) |  |  |
 | Address1_FreightTermsCodeName2 | nvarchar (200) (picklist) |  | FOB No Charge | Null
Details tab |  |  |  |  |
Territory | TerritoryId | int | Relationship |  |
 | TerritoryIdName2 | nvarchar (200) |  |  |
Category | AccountCategoryCode | int (picklist) |  |  |
 | AccountCategoryCodeName2 | nvarchar (200) (picklist) |  | Preferred Customer Standard | Null
Industry | IndustryCode | int (picklist) |  |  |
 | IndustryCodeName2 | nvarchar (200) (picklist) |  | See IndustryCodeName. | Null
Annual Revenue ($) | Revenue | money |  |  |
No. of Employees | NumberOfEmployees | int |  |  |
SIC Code | SIC | nvarchar (20) |  |  |
Ownership | OwnershipCode | int (picklist) |  |  |
 | OwnershipCodeName2 | nvarchar (200) (picklist) |  | Public Private Subsidiary Other | Null
Ticker Symbol | TickerSymbol | nvarchar (10) |  |  |
Description | Description | ntext |  |  |
Administration tab |  |  |  |  |
Owner | OwningUser | int | Required |  |
 | OwningUserName | nvarchar (255) |  |  |
Originating Lead | OriginatingLeadId | int | Relationship |  |
 | OriginatingLeadIdName2 | nvarchar (200) |  |  |
Credit Limit ($) | CreditLimit | money |  |  |
Credit Hold | CreditOnHold | bit |  | 0 (No) 1 (Yes) | 0
Payment Terms | PaymentTermsCode | int (picklist) |  |  |
 | PaymentTermsCodeName2 | nvarchar (200) (picklist) |  | Net 30 2% 10, Net 30 Net 45 Net 60 | Null
Price List | DefaultPriceLevelId | int | Relationship |  |
 | DefaultPriceLevelIdName2 | nvarchar (100) |  |  |
Preferred | PreferredContactMethodCode | int (picklist) |  |  | 1
 | PreferredContactMethodCodeName2 | nvarchar (200) (picklist) |  | Any E-mail Phone Fax Mail | Any
E-mail | DoNotEmail | bit |  | 0 (Allow) 1 (Do Not Allow) | 0
Phone | DoNotPhone | bit |  | 0 (Allow) 1 (Do Not Allow) | 0
Fax | DoNotFax | bit |  | 0 (Allow) 1 (Do Not Allow) | 0
Mail | DoNotPostalMail | bit |  | 0 (Allow) 1 (Do Not Allow) | 0
Optional attributes |  |  |  |  |
 | StatusCode1 | int (status) |  | 1 (Active) 2 (Inactive) | For state code 0, 1 For state code 1, 2
 | AccountClassificationCode | int (picklist) |  |  |
 | AccountClassificationCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | AccountRatingCode | int (picklist) |  |  |
 | AccountRatingCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | Address1_County | nvarchar (50) |  |  |
 | Address1_Fax | nvarchar (20) |  |  |
 | Address1_Latitude | float |  |  |
 | Address1_Longitude | float |  |  |
 | Address1_PostOfficeBox | nvarchar (20) |  |  |
 | Address1_PrimaryContactName | nvarchar (150) |  |  |
 | Address1_Telephone2 | nvarchar (50) |  |  |
 | Address1_Telephone3 | nvarchar (50) |  |  |
 | Address1_UPSZone | nvarchar (4) |  |  |
 | Address2_AddressTypeCode | int (picklist) |  |  |
 | Address2_AddressTypeCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | Address2_City | nvarchar (50) |  |  |
 | Address2_Country | nvarchar (50) |  |  |
 | Address2_County | nvarchar (50) |  |  |
 | Address2_Fax | nvarchar (20) |  |  |
 | Address2_FreightTermsCode | int (picklist) |  |  |
 | Address2_FreightTermsCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | Address2_Latitude | float |  |  |
 | Address2_Line1 | nvarchar (50) |  |  |
 | Address2_Line2 | nvarchar (50) |  |  |
 | Address2_Line3 | nvarchar (50) |  |  |
 | Address2_Longitude | float |  |  |
 | Address2_Name | nvarchar (200) |  |  |
 | Address2_PostalCode | nvarchar (20) |  |  |
 | Address2_PostOfficeBox | nvarchar (20) |  |  |
 | Address2_PrimaryContactName | nvarchar (150) |  |  |
 | Address2_ShippingMethodCode | int (picklist) |  |  |
 | Address2_ShippingMethodCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | Address2_StateOrProvince | nvarchar (50) |  |  |
 | Address2_Telephone1 | nvarchar (50) |  |  |
 | Address2_Telephone2 | nvarchar (50) |  |  |
 | Address2_Telephone3 | nvarchar (50) |  |  |
 | Address2_UPSZone | nvarchar (4) |  |  |
 | BusinessTypeCode | int (picklist) |  |  |
 | BusinessTypeCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | CustomerSizeCode | int (picklist) |  |  |
 | CustomerSizeCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | DoNotBulkEmail | bit |  | 0 (True) 1 (False) | 1
 | DoNotBulkPostalMail | bit |  | 0 (True) 1 (False) | 1
 | EmailAddress2 | nvarchar (100) |  |  |
 | EmailAddress3 | nvarchar (100) |  |  |
 | FtpSiteUrl | nvarchar (200) |  |  |
 | MarketCap | money |  |  |
 | SharesOutstanding | int |  |  |
 | StockExchange | nvarchar (20) |  |  |
 | Telephone3 | nvarchar (50) |  |  |
 | TerritoryId | int | Relationship |  |
 | TerritoryIdName2 | nvarchar (200) |  |  |
 | Address1_UTCOffset | int |  |  |
 | Address2_UTCOffset | int |  |  |
Not migrated | IsPrivate |  |  |  |
 | Address1_AddressId |  |  |  |
 | Address2_AddressId |  |  |  |
 | Aging30 |  |  |  |
 | Aging60 |  |  |  |
 | Aging90 |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | OwnerId |  |  |  |
 | OwnerIdType |  |  |  |
 | OwningTeam |  |  |  |
 | ParticipatesInWorkflow |  |  |  |
 | SecurityDescriptor |  |  |  |
 | VersionNumber |  |  |  |

1 See StateCode and StatusCode Values.

2 The field is used only in the CDF database; it is not migrated.


cdf_Activity Table

Data in the cdf_Activity table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Activity table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Activity attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | ActivityId | int (PK) | Required |  |
 | StateCode1 | int (state) |  | 0 (Open) 1 (Completed) 2 (Canceled) | 0
 | ParentActivityId | int | Relationship |  |
 | ActivityTypeCode | int (picklist) | Required |  |
 | ActivityTypeCodeName2 | nvarchar (200) (picklist) |  | Task (134) Fax (136) Phone Call (137) E-mail (138) Letter (141) Appointment (142) Resolution (140) |
All Activity tabs |  |  |  |  |
Subject | Subject | nvarchar (200) |  |  |
Body | Description5 | ntext |  |  |
Regarding | ObjectId | int | Relationship |  |
 | ObjectName2 | nvarchar (500) |  |  |
 | ObjectTypeCode3 | int (picklist) |  |  |
 | ObjectTypeCodeName3 | nvarchar (200) (picklist) |  | Account (1) Contact (2) Lead (4) Opportunity (3) Quote (1084) Order (1088) Invoice (1090) Case (112) Contract (1010)8 |
Owner | OwningUser | int | Required, Relationship |  |
 | OwningUserName2 | nvarchar (255) |  |  |
Duration | ScheduledDurationMinutes (for open activities) ActualDurationMinutes (for closed activities)4, 6 | int |  | 1 minute 5 minutes 15 minutes 30 minutes 45 minutes 1 hour 1.5 hours 2 hours 3 hours 3.5 hours 4 hours 4.5 hours 5 hours 5.5 hours 6 hours 6.5 hours 7 hours 7.5 hours 8 hours 1 day 2 days 3 days | 30 minutes
Due | ScheduledStart (for open activities) ActualStart (for closed activities)4 | datetime |  |  |
Priority | PriorityCode | int (picklist) |  |  |
 | PriorityCodeName2 | nvarchar (150) (picklist) |  | High Normal Low | Normal
Category | Category | nvarchar (250) |  |  |
Sub-Category | SubCategory | nvarchar (250) |  |  |
Letter activity |  |  |  |  |
Sender | Associated cdf_ActivityParty record with ParticipationTypeMask=1 | int |  |  |
Recipient | Associated cdf_ActivityParty record with ParticipationTypeMask=2 | int |  |  |
Address | Location | nvarchar (200) |  |  |
Direction | DirectionCode3 | int (picklist) | Required | 0 1 | 0
 | DirectionCodeName2 | nvarchar (150) (picklist) |  | Outgoing (0) Incoming (1) | Outgoing
Fax activity |  |  |  |  |
Sender | Associated cdf_ActivityParty record with ParticipationTypeMask=1 | int |  |  |
Recipient | Associated cdf_ActivityParty record with ParticipationTypeMask=2 | int |  |  |
Fax Number | Location | nvarchar (200) |  |  |
Direction | DirectionCode3 | int (picklist) | Required | 0 1 | 0
 | DirectionCodeName2 | nvarchar (200) (picklist) |  | Outgoing (0) Incoming (1) | Outgoing
Phone Call activity |  |  |  |  |
Call Initiator | Associated cdf_ActivityParty record with ParticipationTypeMask=1 | int |  |  |
Call Recipient | Associated cdf_ActivityParty record with ParticipationTypeMask=2 | int |  |  |
Phone Number | Location | nvarchar (200) |  |  |
Direction | DirectionCode3 | int (picklist) | Required | 0 1 | 0
 | DirectionCodeName2 | nvarchar (200) (picklist) |  | Outgoing (0) Incoming (1) | Outgoing
E-mail activity |  |  |  |  |
From | Associated cdf_ActivityParty record with ParticipationTypeMask=1 | int | Relationship |  |
To | Associated cdf_ActivityParty record with ParticipationTypeMask=2 | int | Relationship |  |
Cc | Associated cdf_ActivityParty record with ParticipationTypeMask=3 | int | Relationship |  |
Bcc | Associated cdf_ActivityParty record with ParticipationTypeMask=4 | int | Relationship |  |
Direction | DirectionCode3 | int (picklist) | Required | 0 1 |
 | DirectionCodeName2 | nvarchar (200) (picklist) |  | Outgoing (0) Incoming (1) | Outgoing
Appointment activity |  |  |  |  |
Organizer | Associated cdf_ActivityParty record with ParticipationTypeMask=7 | int | Relationship |  |
Attendees | Associated cdf_ActivityParty record with ParticipationTypeMask=5 | int | Relationship |  |
Location | Location | nvarchar (200) |  |  |
Start Time | ScheduledStart (for open appointments) ActualStart (for closed appointments) 4, 7 | datetime |  |  |
End Time | ScheduledEnd (for open appointments) ActualEnd (for closed appointments) 4, 7 | datetime |  |  |
All day event | AllDayEvent | bit |  | 0 (False) 1 (True) |
Not migrated |  |  |  |  |
 | Sender9 |  |  |  |
 | ToRecipients9 |  |  |  |
 | CompetitorId |  |  |  |
 | CompetitorIdName |  |  |  |
 | MimeType |  |  |  |
 | ReadReceiptRequested |  |  |  |
 | PercentComplete |  |  |  |
 | DeliveryReceiptRequested |  |  |  |
 | Billed |  |  |  |
 | Misc1 |  |  |  |
 | Misc2 |  |  |  |
 | Misc3 |  |  |  |
 | NumberOfPages |  |  |  |
 | ActualRevenue |  |  |  |
 | TimeSpent |  |  |  |
 | StatusCode1 |  |  |  |
 | IsPrivate |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | OwnerId |  |  |  |
 | OwnerIdType |  |  |  |
 | OwningTeam |  |  |  |
 | SecurityDescriptor |  |  |  |
 | VersionNumber |  |  |  |

1 See StateCode and StatusCode Values.

2 The field is used only in the CDF database; it is not migrated.

3 These drop-down lists (picklists) are not in the cdf_StringMapCrm table; you must cleanse the data in these attributes manually.

4 The value of ActualDurationMinutes must equal ActualEnd - ActualStart, or the record does not migrate.

5 The value of Description can include plain text or HTML, but it should not contain MIME headers.

6 These values are set in a user interface control rather than stored in a drop-down list (picklist) in Microsoft CRM. You can use any values, or you can cleanse your data to match the lists in the user interface control.

7 Values for all attributes of the type datetime must be in the Coordinated Universal Time (UTC) format CCYY-MM-DD, where CC is the century (00-99), YY is the year (00-99), MM is the month (01-12), and DD is the day of month (01-31). An example is 2003-09-05. If a time is included, it is migrated as the Greenwich Mean Time (GMT).

8 Because Contracts are not included in the Data Migration Framework, activities related to contracts will not be migrated.

9 The Sender and ToRecipients data is not migrated. You can use this data to determine the appropriate cdf_ActivityParty records to create.


cdf_ActivityParty Table

An ActivityParty record stores the names of any person referred to in the associated activity. Typically several ActivityParty records can be associated with each activity.

Data in the cdf_ActivityParty table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_ActivityParty table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM ActivityParty attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | ActivityId | int | Required, Relationship |  |
 | ActivityPartyId | int (PK) | Required |  |
Any party referred to in the Activity 3 | PartyObjectTypeCode1 | int (picklist) | Required | See ObjectTypeCode Values | 2
 | PartyObjectTypeCodeName2 | nvarchar (200) (picklist) |  | Account (1) Contact (2) Lead (4) Opportunity (3) User (8) |
ID of the party | PartyId | int | Relationship |  |
 | PartyIdName2 | nvarchar (2000) |  |  |
Role of the party | ParticipationTypeMask | int | Required | 1 (Sender) 2 (To) 3 (Cc) 4 (Bcc) 5 (Required) 6 (Optional) 7 (Organizer) 8 (Regarding)3 9 (Owner)3 |
E-mail address of the party | AddressUsed | nvarchar (2000) |  |  |

1 PartyObjectTypeCode data is not in the cdf_StringMapCrm table; you must cleanse the data manually. No default value is used for PartyObjectTypeCode; a value must be specified.

2 The field is used only in the CDF database; it is not migrated.

3 You should create an ActivityParty record for all parties except for the owner of the activity, and the object the activity is regarding. ActivityParty records for the owner and object the activity is regarding are automatically created when the activity is migrated.

4 This attribute needs to be populated only for e-mail activities. If it is blank, Microsoft CRM will assume the party referred to has no e-mail address, and when you go to the activity, you'll see an error message stating that a recipient does not have an e-mail address. The actual string in AddressUsed is not used; Microsoft CRM uses the e-mail address stored in the record for the referred to contact, lead, account, opportunity or user. You can either populate AddressUsed for all ActivityParty records related to e-mail activities with a string such as the actual e-mail address or "HasEmailAddress", or write a procedure to check the party's record and set the AddressUsed value only for those parties with e-mail addresses.


cdf_Annotation Table

Data in the cdf_Annotation table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Annotation table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Annotation attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | AnnotationId | int (PK) | Required |  |
 | ObjectTypeCode1 | int (picklist) |  | See ObjectTypeCode Values |
 | ObjectTypeCodeName2 | nvarchar (200) (picklist) |  | Fax (136) Phone Call (137) Task (134) E-mail (138) Letter (141) Appointment (142) Lead (4) Opportunity (3) Account (1) Contact (2) Competitor (123) Product (1024) Quote (1084) Order (1088) Invoice (1090) Incident (112) |
 | ObjectId | int | Relationship |  |
 | OwningUser | int | Required, Relationship |  |
 | OwningUserName2 | nvarchar (255) |  |  |
 | IsDocument | bit | Required | 0 (False) 1 (True)3 | 1
Notes |  |  |  |  |
Title | Subject | nvarchar (500) |  |  |
Description | NoteText | ntext |  |  |
Not migrated | MimeType4 |  |  |  |
 | LangId4 |  |  |  |
 | FileSize4 |  |  |  |
 | FileName4 |  |  |  |
 | IsPrivate |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | OwnerId |  |  |  |
 | OwnerIdType |  |  |  |
 | OwningTeam |  |  |  |
 | SecurityDescriptor |  |  |  |
 | VersionNumber |  |  |  |

1 ObjectTypeCode data is not in the cdf_StringMapCrm table; you must cleanse the data manually.

2 The field is used only in the CDF database; it is not migrated.

3 Must be set to 0 in the CDF database. The Microsoft CRM Data Migration Framework does not migrate attachments.

4 This data applies to attached files, which are not migrated.


cdf_Competitor Table

Data in the cdf_Competitor table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Competitor table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Competitor attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | CompetitorId | int (PK) | Required |  |
General tab |  |  |  |  |
Name | Name | nvarchar (100) | Required |  |
Ticker Symbol | StockExchange | nvarchar (20) |  |  |
Key Product | KeyProduct | nvarchar (200) |  |  |
Web Site | WebSiteUrl | nvarchar (200) |  |  |
Reported Revenue ($) | ReportedRevenue | money |  |  |
Street 1 | Address1_Line1 | nvarchar (50) |  |  |
Street 2 | Address1_Line2 | nvarchar (50) |  |  |
Street 3 | Address1_Line3 | nvarchar (50) |  |  |
City | Address1_City | nvarchar (50) |  |  |
State/Province | Address1_StateOrProvince | nvarchar (50) |  |  |
ZIP/Postal Code | Address1_PostalCode | nvarchar (20) |  |  |
Country/Region | Address1_Country | nvarchar (50) |  |  |
Analysis tab |  |  |  |  |
Overview | Overview | ntext |  |  |
Strength | Strengths | ntext |  |  |
Weakness | Weaknesses | ntext |  |  |
Opportunity | Opportunities | ntext |  |  |
Threat | Threats | ntext |  |  |
Not on tab by default |  |  |  |  |
 | Address1_TypeCode | int (picklist) |  |  |
 | Address1_TypeCodeName1 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | Address1_County | nvarchar (50) |  |  |
 | Address1_Fax | nvarchar (20) |  |  |
 | Address1_Latitude | float |  |  |
 | Address1_Longitude | float |  |  |
 | Address1_Name | nvarchar (200) |  |  |
 | Address1_PostOfficeBox | nvarchar (20) |  |  |
 | Address1_ShippingMethodCode | int (picklist) |  |  |
 | Address1_ShippingMethodCodeName1 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | Address1_Telephone1 | nvarchar (50) |  |  |
 | Address1_Telephone2 | nvarchar (50) |  |  |
 | Address1_Telephone3 | nvarchar (50) |  |  |
 | Address1_UPSZone | nvarchar (4) |  |  |
 | Address2_AddressTypeCode | int (picklist) |  |  |
 | Address2_AddressTypeCodeName1 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | Address2_City | nvarchar (50) |  |  |
 | Address2_Country | nvarchar (50) |  |  |
 | Address2_County | nvarchar (50) |  |  |
 | Address2_StateOrProvince | nvarchar (50) |  |  |
 | Address2_Fax | nvarchar (20) |  |  |
 | Address2_Latitude | float |  |  |
 | Address2_Line1 | nvarchar (50) |  |  |
 | Address2_Line2 | nvarchar (50) |  |  |
 | Address2_Line3 | nvarchar (50) |  |  |
 | Address2_Longitude | float |  |  |
 | Address2_Name | nvarchar (200) |  |  |
 | Address2_PostalCode | nvarchar (20) |  |  |
 | Address2_PostOfficeBox | nvarchar (20) |  |  |
 | Address2_ShippingMethodCode | int (picklist) |  | Default Value | Default Value
 | Address2_ShippingMethodCodeName1 | nvarchar (200) (picklist) |  |  |
 | Address2_Telephone1 | nvarchar (50) |  |  |
 | Address2_Telephone2 | nvarchar (50) |  |  |
 | Address2_Telephone3 | nvarchar (50) |  |  |
 | Address2_UPSZone | nvarchar (4) |  |  |
 | ReferenceInfoUrl | nvarchar (200) |  |  |
 | ReportingQuarter | int |  |  |
 | ReportingYear | int |  |  |
 | TickerSymbol | nvarchar (10) |  |  |
 | WinPercentage | float |  |  |
 | Address1_UTCOffset | int |  |  |
 | Address1_FreightTermsCode | int |  |  |
 | Address1_PrimaryContactName | nvarchar (150) |  |  |
 | Address2_UTCOffset | int |  |  |
 | Address2_FreightTermsCode | int |  |  |
 | Address2_PrimaryContactName | nvarchar (150) |  |  |
Not migrated |  |  |  |  |
 | Address1_AddressId |  |  |  |
 | Address2_AddressId |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedOn |  |  |  |
 | ModifiedBy |  |  |  |
 | SecurityDescriptor |  |  |  |
 | VersionNumber |  |  |  |

1 The field is used only in the CDF database; it is not migrated.


cdf_Contact Table

Data in the cdf_Contact table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Contact table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Contact attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | ContactId | int (PK) | Required |  |
 | StateCode1 | int (state) |  | 0 (Active) 1 (Inactive) | 0
 | StatusCode1 | int (status) |  | 1 (Active) | For StateCode 0, 1
 |  |  |  | 2 (Inactive) | For StateCode 1, 2
 | ParentContactId |  | Relationship |  |
 | ParentContactIdName2 | nvarchar (160) |  |  |
General tab |  |  |  |  |
Salutation | Salutation | nvarchar (100) |  |  |
First Name | FirstName | nvarchar (50) |  |  |
Middle Name | MiddleName | nvarchar (50) |  |  |
Last Name | LastName | nvarchar (50) |  |  |
Job Title | JobTitle | nvarchar (100) |  |  |
Parent Account | AccountId | int | Relationship |  |
 | AccountIdName2 | nvarchar (160) |  |  |
Business Phone | Telephone1 | nvarchar (50) |  |  |
Home Phone | Telephone2 | nvarchar (50) |  |  |
Mobile Phone | MobilePhone | nvarchar (50) |  |  |
Fax | Fax | nvarchar (50) |  |  |
Pager | Pager | nvarchar (50) |  |  |
E-mail | EmailAddress1 | nvarchar (100) |  |  |
Address Name | Address1_Name | nvarchar (200) |  |  |
Street 1 | Address1_Line1 | nvarchar (50) |  |  |
Street 2 | Address1_Line2 | nvarchar (50) |  |  |
Street 3 | Address1_Line3 | nvarchar (50) |  |  |
City | Address1_City | nvarchar (50) |  |  |
State/Province | Address1_StateOrProvince | nvarchar (50) |  |  |
ZIP/PostalCode | Address1_PostalCode | nvarchar (20) |  |  |
Country/Region | Address1_Country | nvarchar (50) |  |  |
Phone | Address1_Telephone | nvarchar (50) |  |  |
Address Type | Address1_AddressTypeCode | int (picklist) |  |  |
 | Address1_AddressTypeCodeName2 | nvarchar (200) (picklist) |  |  |
Shipping Method | Address1_ShippingMethodCode | int (picklist) |  |  |
 | Address1_ShippingMethodCodeName2 | nvarchar (200) (picklist) |  |  |
Freight Terms | Address1_FreightTermsCode | int (picklist) |  |  |
 | Address1_FreightTermsCodeName2 | nvarchar (200) (picklist) |  |  |
Details tab |  |  |  |  |
Department | Department | nvarchar (100) |  |  |
Role | AccountRoleCode | int (picklist) |  |  |
 | AccountRoleCodeName2 | nvarchar (200) (picklist) |  | Decision Maker Employee Influencer | Null
Manager | ManagerName | nvarchar (100) |  |  |
Manager's Phone | ManagerPhone | nvarchar (50) |  |  |
Assistant | AssistantName | nvarchar (100) |  |  |
Assistant's Phone | AssistantPhone | nvarchar (50) |  |  |
Gender | GenderCode | int (picklist) |  |  |
 | GenderCodeName2 | nvarchar (200) (picklist) |  | Male Female | Null
Marital Status | FamilyStatusCode | int (picklist) |  |  | Null
 | FamilyStatusCodeName2 | nvarchar (200) (picklist) |  | Single Married Divorced Widowed | Null
Spouse's Name | SpousesName | nvarchar (100) |  |  |
Birthday | Birthdate3 | datetime |  |  |
Anniversary | Anniversary3 | datetime |  |  |
Description | Description | ntext |  |  |
Administration tab |  |  |  |  |
Owner | OwningUser | int | Required, Relationship |  |
 | OwningUserName2 | nvarchar (255) |  |  |
Originating Lead | OriginatingLeadId | int | Relationship |  |
 | OriginatingLeadIdName2 | nvarchar (160) |  |  |
Credit Limit ($) | CreditLimit | money |  |  |
Credit Hold | CreditOnHold | bit |  | 0 (No) 1 (Yes) | 0
Payment Terms | PaymentTermsCode | int (picklist) |  |  |
 | PaymentTermsCodeName2 | nvarchar (200) (picklist) |  | Net 30 2%10, Net 30 Net 45 Net 60 | Null
Price List | DefaultPriceLevelId | int | Relationship |  |
 | DefaultPriceLevelIdName2 | nvarchar (100) |  |  |
Preferred | PreferredContactMethodCode | int (picklist) |  |  | 1
 | PreferredContactMethodCodeName2 | nvarchar (200) (picklist) |  | Any E-mail Phone Fax Mail | Any
E-mail | DoNotEmail | bit |  | 0 (Allow) 1 (Do Not Allow) | 0
Phone | DoNotPhone | bit |  | 0 (Allow) 1 (Do Not Allow) | 0
Fax | DoNotFax | bit |  | 0 (Allow) 1 (Do Not Allow) | 0
Mail | DoNotPostalMail | bit |  | 0 (Allow) 1 (Do Not Allow) | 0
Not on tab by default | Address1_Fax | nvarchar (20) |  |  |
 | Address1_Latitude | float |  |  |
 | Address1_Longitude | float |  |  |
 | Address1_PostOfficebox | nvarchar (20) |  |  |
 | Address1_PrimaryContactName | nvarchar (150) |  |  |
 | Address1_Telephone2 | nvarchar (50) |  |  |
 | Address1_Telephone3 | nvarchar (50) |  |  |
 | Address1_UPSZone | nvarchar (4) |  |  |
 | Address1_County | nvarchar (50) |  |  |
 | Address2_AddressTypeCode | int (picklist) |  |  |
 | Address2_AddressTypeCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | Address2_City | nvarchar (50) |  |  |
 | Address2_Country | nvarchar (50) |  |  |
 | Address2_County | nvarchar (50) |  |  |
 | Address2_Fax | nvarchar (20) |  |  |
 | Address2_FreightTermsCode | int (picklist) |  |  |
 | Address2_FreightTermsCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | Address2_Latitude | float |  |  |
 | Address2_Line1 | nvarchar (50) |  |  |
 | Address2_Line2 | nvarchar (50) |  |  |
 | Address2_Line3 | nvarchar (50) |  |  |
 | Address2_Longitude | float |  |  |
 | Address2_Name | nvarchar (200) |  |  |
 | Address2_PostalCode | nvarchar (20) |  |  |
 | Address2_PostOfficeBox | nvarchar (20) |  |  |
 | Address2_PrimaryContactName | nvarchar (150) |  |  |
 | Address2_ShippingMethodCode | int (picklist) |  |  |
 | Address2_ShippingMethodCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | Address2_StateOrProvince | nvarchar (50) |  |  |
 | Address2_Telephone1 | nvarchar (50) |  |  |
 | Address2_Telephone2 | nvarchar (50) |  |  |
 | Address2_Telephone3 | nvarchar (50) |  |  |
 | Address2_UPSZone | nvarchar (4) |  |  |
 | Address1_UTCOffset | int |  |  |
 | Address2_UTCOffset | int |  |  |
 | AnnualIncome | money |  |  |
 | ChildrensNames | nvarchar (255) |  |  |
 | CustomerSizeCode | int (picklist) |  |  |
 | CustomerSizeCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | CustomerTypeCode | int (picklist) |  |  |
 | CustomerTypeCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | DoNotBulkEmail | bit |  | 0 (False) 1 (True) | 1
 | DoNotBulkPostalMail | bit |  | 0 (False) 1 (True) | 1
 | EducationCode | int (picklist) |  |  |
 | EducationCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | EmailAddress2 | nvarchar (100) |  |  |
 | EmailAddress3 | nvarchar (100) |  |  |
 | EmployeeId | nvarchar (50) |  |  |
 | FtpSiteUrl | nvarchar (200) |  |  |
 | FullName | nvarchar (160) |  |  |
 | GovernmentId | nvarchar (50) |  |  |
 | HasChildrenCode | int (picklist) |  |  |
 | HasChildrenCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | IsBackOfficeCustomer | bit |  | 0 (False) 1 (True) | 0
 | LeadSourceCode | int (picklist) |  |  |
 | LeadSourceCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | NickName | nvarchar (50) |  |  |
 | NumberOfChildren | int |  |  |
 | ShippingMethodCode | int (picklist) |  |  |
 | ShippingMethodCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | Status Reason | int (status) |  |  |
 | Suffix | nvarchar (10) |  |  |
 | Telephone3 | nvarchar (50) |  |  |
 | TerritoryCode | int (picklist) |  |  |
 | TerritoryCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | WebSiteUrl | nvarchar (200) |  |  |
 | YomiFirstName | nvarchar (150) |  |  |
 | YomiFullName | nvarchar (450) |  |  |
 | YomiLastName | nvarchar (150) |  |  |
 | YomiMiddleName | nvarchar (150) |  |  |

1 See StateCode and StatusCode Values.

2 The field is used only in the CDF database; it is not migrated.

3 Values for all attributes of the type datetime must be in the Coordinated Universal Time (UTC) format CCYY-MM-DD, where CC is the century (00-99), YY is the year (00-99), MM is the month (01-12), and DD is the day of month (01-31). An example is 2003-09-05. If a time is included, it is migrated as the Greenwich Mean Time (GMT) time.


cdf_CustomerAddress Table

Data in the cdf_CustomerAddress table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_CustomerAddress table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM CustomerAddress attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | ParentId | int | Required, Relationship |  |
 | CustomerAddressId | int (PK) | Required |  |
 | ObjectTypeCode | int (picklist) | Required | 1 | 1
 |  |  |  | 2 |
 | ObjectTypeCodeName2 | nvarchar (150) (picklist) |  | Account (1) Contact (2) |
General tab |  |  |  |  |
Address Name | Name | nvarchar (200) |  |  |
Street 1 | Line1 | nvarchar (50) |  |  |
Street 2 | Line2 | nvarchar (50) |  |  |
Street 3 | Line3 | nvarchar (50) |  |  |
City | City | nvarchar (50) |  |  |
State/Province | StateOrProvince | nvarchar (50) |  |  |
ZIP/Postal Code | PostalCode | nvarchar (20) |  |  |
Country/Region | Country | nvarchar (50) |  |  |
Address Type | AddressTypeCode | int (picklist) |  |  |
 | AddressTypeCodeName2 | nvarchar (150) (picklist) |  | Bill To Ship To Primary Other | Null
Main Phone | Telephone1 | nvarchar (50) |  |  |
Phone 2 | Telephone2 | nvarchar (50) |  |  |
Fax | Fax | nvarchar (50) |  |  |
Shipping Method | ShippingMethodCode | int (picklist) |  |  |
 | ShippingMethodCodeName2 | nvarchar (200) (picklist) |  | Airborne DHL FedEx UPS Postal Mail Full Load Will Call | Null
Freight Terms | FreightTermsCode | int (picklist) |  |  |
 | FreightTermsCodeName2 | nvarchar (150) (picklist) |  | FOB No Charge | Null
Address Contact | PrimaryContactName | nvarchar (150) |  |  |
Not on tab by default | AddressNumber | int |  |  |
 | County | nvarchar (50) |  |  |
 | Latitude | float |  |  |
 | Longitude | float |  |  |
 | PostOfficeBox | nvarchar (20) |  |  |
 | Telephone3 | nvarchar (50) |  |  |
 | UTCOffset | int |  |  |
 | UPSZone | nvarchar (4) |  |  |
Not migrated |  |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | VersionNumber |  |  |  |

1 ObjectTypeCode data is not in the cdf_StringMapCrm table; you must cleanse the data manually.

2 The field is used only in the CDF databse; it is not migrated.


cdf_Discount Table

Data in the cdf_Discount table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Discount table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Discount attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | DiscountId | int (PK) | Required |  |
 | DiscountTypeId | int | Required, Relationship |  |
 | DiscountTypeIdName1 | nvarchar (100) |  |  |
 | IsAmountType | bit | Required | 0 (Percentage) 1 (Amount) | 0
General tab |  |  |  |  |
Begin Quantity | LowQuantity | decimal 9 (18,5) | Required |  |
End Quantity | HighQuantity | decimal 9 (18,5) | Required |  |
Amount ($) | Amount3 | money |  |  |
Percentage | Percentage3 | decimal 9 (10,5) |  |  |
Not migrated | StateCode2 |  |  |  |
 | StatusCode2 |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | VersionNumber |  |  |  |

1 The field is used only in the CDF database; it is not migrated.

2 The values of StateCode and StatusCode are controlled by the associated cdf_DiscountType record. These attributes are not brought into the cdf_StringMapCrm table, and data in these fields is not migrated.

3 Each record should include either a Percentage or an Amount, but not both.


cdf_DiscountType Table

Data in the cdf_DiscountType table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_DiscountType table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM DiscountType attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | DiscountTypeId | int (PK) | Required |  |
 | StateCode1 | int (state) |  | 0 (Active) 1 (Inactive) | 0
General tab |  |  |  |  |
Name | Name | nvarchar (100) | Required |  |
Description | Description | memo |  |  |
Type | IsAmountType | bit |  | 0 (Percentage) 1 (Amount) | 0
Not migrated | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | StatusCode |  |  |  |
 | VersionNumber |  |  |  |

1 See StateCode and StatusCode Values.


cdf_Incident Table

Data in the cdf_Incident table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Incident table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Incident attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | IncidentId | int (PK) | Required |  |
 | StateCode1 | int (state) |  | 0 (Active) 1 (Resolved) 2 (Canceled) | 0
 | ParentIncidentId | int | Relationship |  |
General tab |  |  |  |  |
Owner | OwningUser | int | Required, Relationship |  |
 | OwningUserName2 | nvarchar (255) |  |  |
Status Reason | StatusCode1 | int (status) |  | 1 (In Progress) 2 (On Hold) 3 (Waiting for Details) 4 (Researching) | For StateCode 0, 1
 |  |  |  | 5 (Problem Solved) | For StateCode 1, 5
 |  |  |  | 6 (Canceled) | For StateCode 2, 6
Customer | ContactId | int | Required3 , Relationship |  |
 | ContactIdName2 | nvarchar (160) |  |  |
 | AccountId | int | Required3 , Relationship |  |
 | AccountIdName2 | nvarchar (160) |  |  |
Title | Title | nvarchar (200) | Relationship |  |
Subject | SubjectId | int | Relationship |  |
 | SubjectIdName2 | nvarchar (500) |  |  |
Description | Description | ntext |  |  |
Details tab |  |  |  |  |
Contract | ContractId | int |  |  |
Contract Line | ContractDetailId | int |  |  |
Product | ProductId | int |  |  |
 | ProductIdName2 | nvarchar (100) |  |  |
Serial Number | ProductSerialNumber | nvarchar (100) |  |  |
Follow Up By | FollowupBy4 | datetime |  |  |
Service Level | PriorityCode | int (picklist) |  |  |
 | PriorityCodeName2 | nvarchar (200) (picklist) |  | Gold Silver Bronze | Null
Case Origin | CaseOriginCode | int (picklist) |  |  |
 | CaseOriginCodeName2 | nvarchar (200) (picklist) |  | Phone E-mail Web | Null
Priority | ContractServiceLevelCode | int (picklist) |  |  |
 | ContractServiceLevelCodeName2 | nvarchar (200) (picklist) |  | High Normal Low | Normal
Satisfaction | CustomerSatisfactionCode | int (picklist) |  |  |
 | CustomerSatisfactionCodeName2 | nvarchar (200) (picklist) |  | Very Satisfied Satisfied Neutral Dissatisfied Very Dissatisfied | Null
Case Type | CaseTypeCode | int (picklist) |  |  |
 | CaseTypeCodeName2 | nvarchar (200) (picklist) |  | Question Problem Request | Null
Not on tab by default |  |  |  |  |
 | ActualServiceUnits | int |  |  |
 | BilledServiceUnits | int |  |  |
Case No. | TicketNumber | nvarchar (100) |  |  |
 | IncidentStageCode | int (picklist) |  |  |
 | IncidentStageCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | IsDecrementing | bit |  | 0 (False) 1 (True) | 1
 | ResponsibleContactId | int | Relationship |  |
 | ResponsibleContactIdName2 | nvarchar (160) |  |  |
 | SeverityCode | int (picklist) |  |  |
 | SeverityCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
Not migrated |  |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | VersionNumber |  |  |  |
 | CustomerId |  |  |  |
 | CustomerIdType |  |  |  |
 | OwnerId |  |  |  |
 | OwnerIdType |  |  |  |
 | OwningTeam |  |  |  |
 | SecurityDescriptor |  |  |  |

1 See StateCode and StatusCode Values.

2 The field is used only in the CDF database; it is not migrated.

3 Either ContactId or AccountId is required.

4 Values for all attributes of type datetime must be in Coordinated Universal Time (UTC) format CCYY-MM-DD, where CC is the century (00-99), YY is the year (00-99), MM is the month (01-12), and DD is the day of month (01-31), for example, 2003-09-05. If a time is included, it is migrated as the Greenwich Mean Time (GMT) time.


cdf_Invoice Table

Data in the cdf_Invoice table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Invoice table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Invoice attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | InvoiceId | int (PK) | Required |  |
 | StateCode1 | int (state) |  | 0 (Active) 1 (Closed) | 0
General tab |  |  |  |  |
Invoice ID | InvoiceNumber | nvarchar (100) | Required |  |
Name | Name | nvarchar (300) |  |  |
Customer | ContactId | int | Required2 , Relationship |  |
 | ContactIdName | nvarchar (160) |  |  |
 | AccountId | int | Required2 , Relationship |  |
 | AccountIdName | nvarchar (160) |  |  |
Price List | PriceLevelId | int | Relationship |  |
 | PriceLevelIdName3 | nvarchar (100) |  |  |
Detail Amount ($) | TotalLineItemAmount4 | money |  |  |
Invoice Discount (%) | DiscountPercentage | decimal 9 (10,5) |  |  |
Invoice Discount ($) | DiscountAmount | money |  |  |
Pre-Freight Amount ($) | TotalAmountLessFreight4 | money |  |  |
Freight Amount ($) | FreightAmount | money |  |  |
Total Tax ($) | TotalTax4 | money |  |  |
Total Amount ($) | TotalAmount4 | money |  |  |
Shipping tab |  |  |  |  |
Shipping Method | ShippingMethodCode | int (picklist) |  |  |
 | ShippingMethodCodeName3 | nvarchar (200) (picklist) |  | Airborne DHL FedEx UPS Postal Mail Full Load Will Call | Null
Payment Terms | PaymentTermsCode | int (picklist) |  |  | Null
 | PaymentTermsCodeName3 | nvarchar (200) (picklist) |  | Net 30 2% 10, Net 30 Net 45 Net 60 | Null
Description | Description | ntext |  |  |
Addresses tab |  |  |  |  |
Bill To Name | BillTo_Name | nvarchar (200) |  |  |
Bill To Street 1 | BillTo_Line1 | nvarchar (50) |  |  |
Bill To Street 2 | BillTo_Line2 | nvarchar (50) |  |  |
Bill To Street 3 | BillTo_Line3 | nvarchar (50) |  |  |
Bill To City | BillTo_City | nvarchar (50) |  |  |
Bill To State/Province | BillTo_StateOrProvince | nvarchar (50) |  |  |
Bill To ZIP/Postal Code | BillTo_PostalCode | nvarchar (20) |  |  |
Bill To Country/Region | BillTo_Country | nvarchar (50) |  |  |
Bill To Phone | BillTo_Telephone | nvarchar (50) |  |  |
Bill To Fax | BillTo_Fax | nvarchar (20) |  |  |
Ship To | WillCall | bit |  | 0 (Address) 1 (Will Call) |
Ship To Name | ShipTo_Name | nvarchar (200) |  |  |
Ship To Street 1 | ShipTo_Line1 | nvarchar (50) |  |  |
Ship To Street 2 | ShipTo_Line2 | nvarchar (50) |  |  |
Ship To Street 3 | ShipTo_Line3 | nvarchar (50) |  |  |
Ship To City | ShipTo_City | nvarchar (50) |  |  |
Ship To State/Province | ShipTo_StateOrProvince | nvarchar (50) |  |  |
Ship To ZIP/Postal Code | ShipTo_PostalCode | nvarchar (20) |  |  |
Ship To Country/Region | ShipTo_Country | nvarchar (50) |  |  |
Ship To Phone | ShipTo_Telephone | nvarchar (50) |  |  |
Ship To Fax | ShipTo_Fax | nvarchar (20) |  |  |
Administration tab |  |  |  |  |
Owner | OwningUser | int | Required, Relationship |  |
 | OwningUserName3 | nvarchar (255) |  |  |
Status Reason | StatusCode1 | int (status) |  | 1 (New) 2 (Partially Shipped) 4 (Billed) 5 (Booked (applies to services) 6 (Installed (applies to services) | For StateCode 0, 1
 |  |  |  | 3 (Canceled) 7 (Paid in Full) | For StateCode 1, 3
Opportunity | OpportunityId | int | Relationship |  |
 | OpportunityIdName3 | nvarchar (300) |  |  |
Order | SalesOrderId | int | Relationship |  |
 | SalesOrderIdName3 | nvarchar (300) |  |  |
Not on tab by default | LastBackofficeSubmit5 | datetime |  |  |
 | PricingErrorCode | int (picklist) |  |  |
 | PricingErrorCodeName3 | nvarchar (200) (picklist) |  |  |
 | PriorityCode | int (picklist) |  |  |
 | PriorityCodeName3 | nvarchar (200) (picklist) |  |  |
 | ShipTo_FreightTermsCode | int (picklist) |  |  |
 | ShipTo_FreightTermsCodeName3 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | TotalDiscountAmount4 | money |  |  |
 | TotalLineItemDiscountAmount4 | money |  |  |
Not migrated |  |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | VersionNumber |  |  |  |
 | CustomerId |  |  |  |
 | CustomerIdType |  |  |  |
 | OwnerId |  |  |  |
 | OwnerIdType |  |  |  |
 | OwningTeam |  |  |  |

1 See StateCode and StatusCode Values.

2 Either AccountId or ContactId is required.

3 The field is used only in the CDF database; it is not migrated.

4 This is a calculated attribute in Microsoft CRM. Because Microsoft CRM calculates the value, data in this attribute is not migrated.

5 Values for all attributes of type datetime must be in Coordinated Universal Time (UTC) format CCYY-MM-DD, where CC is the century (00-99), YY is the year (00-99), MM is the month (01-12), and DD is the day of month (01-31), for example, 2003-09-05. If a time is included, it is migrated as the Greenwich Mean Time (GMT) time.


cdf_InvoiceDetail Table

Data in the cdf_InvoiceDetail table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_InvoiceDetail table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM InvoiceDetail attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | InvoiceDetailId | int (PK) | Required, Relationship |  |
 | InvoiceId |  | Required, Relationship |  |
General tab |  |  |  |  |
Select Product | IsProductOverridden | bit |  | 0 (Existing) 1 (Write In) | 0
Product | ProductId | int | Relationship |  |
 | ProductIdName1 | nvarchar (100) |  |  |
Product Description | ProductDescription | nvarchar (500) |  |  |
Unit | UoMId | int | Relationship |  |
 | UoMIdName1 | nvarchar (100) |  |  |
Pricing | IsPriceOverridden | bit |  | 0 (Use Default) 1 (Overrride Price) | 0
Price Per Unit ($) | PricePerUnit | money |  |  |
Volume Discount ($) | VolumeDiscountAmount2 | money |  |  |
Quantity | Quantity | decimal 9 (18,5) |  |  |
Amount | BaseAmount2 | money |  |  |
Manual Discount ($) | ManualDiscountAmount | money |  |  |
Tax ($) | Tax | money |  |  |
Extended Amount ($) | ExtendedAmount2 | money |  |  |
Delivery tab |  |  |  |  |
Delivered On | ActualDeliveryOn3 | datetime |  |  |
Salesperson | SalesRepId | int | Relationship |  |
 | SalesRepIdName1 | nvarchar (160) |  |  |
Shipped | QuantityShipped | decimal 9 (18,5) |  |  |
Back Ordered | QuantityBackOrdered | decimal 9 (18,5) |  |  |
Fulfilled | QuantityCancelled | decimal 9 (18,5) |  |  |
Address tab |  |  |  |  |
Ship To | WillCall | bit |  | 0 (Address)/ 1 (Will call) | 0
Ship To Name | ShipTo_Name | nvarchar (200) |  |  |
Ship To Street 1 | ShipTo_Line1 | nvarchar (50) |  |  |
Ship To Street 2 | ShipTo_Line2 | nvarchar (50) |  |  |
Ship To Street 3 | ShipTo_Line3 | nvarchar (50) |  |  |
Ship To City | ShipTo_City | nvarchar (50) |  |  |
Ship To State/Province | ShipTo_StateOrProvince | nvarchar (50) |  |  |
Ship To ZIP/Postal Code | ShipTo_PostalCode | nvarchar (20) |  |  |
Ship To Country/Region | ShipTo_Country | nvarchar (50) |  |  |
Ship To Phone | ShipTo_Telephone | nvarchar (50) |  |  |
Ship To Fax | ShipTo_Fax | nvarchar (20) |  |  |
Freight Terms | ShipTo_FreightTermsCode | int (picklist) |  |  |
 | ShipTo_FreightTermsCodeName1 | nvarchar (200) (picklist) |  | FOB No Charge | Null
Not on tab by default |  |  |  |  |
 | Description | ntext |  |  |
 | IsCopied | bit |  | 0 (False) 1 (True) | 1
 | LineItemNumber | int |  |  |
 | InvoiceStateName | nvarchar (200) |  |  |
 | PricingErrorCode | int (picklist) |  |  |
 | PricingErrorCodeName1 | nvarchar (200) |  |  |
 | ShippingTrackingNumber | nvarchar (100) |  |  |
Not migrated |  |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | VersionNumber |  |  |  |

1 The field is used only in the CDF database; it is not migrated.

2 This is a calculated attribute in Microsoft CRM. Because Microsoft CRM calculates the value, data in this attribute is not migrated.

3 Values for all attributes of type datetime must be in Coordinated Universal Time (UTC) format CCYY-MM-DD, where CC is the century (00-99), YY is the year (00-99), MM is the month (01-12), and DD is the day of month (01-31), for example, 2003-09-05. If a time is included, it is migrated as the Greenwich Mean Time (GMT) time.


cdf_Lead Table

Data in the cdf_Lead table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Lead table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Lead attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | LeadId | int (PK) | Required |  |
 | StateCode1 | int (state) |  | 0 (Open) 1 (Qualified) 2 (Disqualified) | 0
General tab |  |  |  |  |
Topic | Subject | nvarchar (100) |  |  |
First Name | FirstName | nvarchar (50) |  |  |
Last Name | LastName | nvarchar (50) |  |  |
Company Name | CompanyName | nvarchar (100) |  |  |
Salutation | Salutation | nvarchar (100) |  |  |
Job Title | JobTitle | nvarchar (100) |  |  |
Rating | LeadQualityCode | int (picklist) |  |  | 2
 | LeadQualityCodeName2 | nvarchar (200) (picklist) |  | Hot Warm Cold | Warm
Business Phone | Telephone1 | nvarchar (50) |  |  |
Home Phone | Telephone2 | nvarchar (50) |  |  |
Other Phone | Telephone3 | nvarchar (50) |  |  |
Mobile Phone | MobilePhone | nvarchar (50) |  |  |
Fax | Fax | nvarchar (50) |  |  |
Pager | Pager | nvarchar (50+G96) |  |  |
E-mail | EmailAddress1 | nvarchar (100) |  |  |
Web Site | WebSiteUrl | nvarchar (200) |  |  |
Description | Description | ntext |  |  |
Details tab |  |  |  |  |
Street 1 | Address1_Line1 | nvarchar (50) |  |  |
Street 2 | Address1_Line2 | nvarchar (50) |  |  |
Street 3 | Address1_Line3 | nvarchar (50) |  |  |
City | Address1_City | nvarchar (50) |  |  |
State/Province | Address1_StateOrProvince | nvarchar (50) |  |  |
ZIP/Postal Code | Address1_PostalCode | nvarchar (20) |  |  |
Country/Region | Address1_Country | nvarchar (50) |  |  |
Annual Revenue ($) | Revenue | money |  |  |
No. of Employees | NumberofEmployees | int |  |  |
SIC Code | SIC | nvarchar (20) |  |  |
Industry | IndustryCode | int (picklist) |  |  |
 | IndustryCodeName2 | nvarchar (200) (picklist) |  |  | Null
Lead Source | LeadSourceCode | int (picklist) |  |  | Null
 | LeadSourceCodeName2 | nvarchar (200) (picklist) |  | Advertisement Employee Referral External Referral Partner Public Relations Seminar Trade Show Web Word of Mouth Other | Null
Administration tab |  |  |  |  |
Owner | OwningUser | int | Required, Relationship |  |
 | OwningUserName2 | nvarchar (255) |  |  |
Status Reason | StatusCode1 | int (status) |  | 1 (New) | For StateCode 0, 1
 |  |  |  | 2 (Contacted) |
 |  |  |  | 3 (Qualified) | For StateCode 1, 3
 |  |  |  | 4 (Lost) 5 (Cannot Contact) 6 (No Longer Interested) 7 (Canceled) | For StateCode 2, 4
Preferred | PreferredContactMethodCode | int (picklist) |  |  | 1
 | PreferredContactMethodCodeName2 | nvarchar (200) (picklist) |  | Any E-mail Phone Fax Mail | Any
E-mail | DoNotEmail | bit |  | 0 (Allow) 1 (Do Not Allow) | 0
Phone | DoNotPhone | bit |  | 0 (Allow) 1 (Do Not Allow) | 0
Fax | DoNotFax | bit |  | 0 (Allow) 1 (Do Not Allow) | 0
Mail | DoNotPostalMail | bit |  | 0 (Allow) 1 (Do Not Allow) | 0
Not on tab by default | Address1_AddressTypeCode | int (picklist) |  |  |
 | Address1_AddressTypeCodeName2 | nvarchar (200) (picklist) |  |  |
 | Address1_County | nvarchar (50) |  |  |
 | Address1_Fax | nvarchar (20) |  |  |
 | Address1_Latitude | float |  |  |
 | Address1_Longitude | float |  |  |
 | Address1_Name | nvarchar (200) |  |  |
 | Address1_PostOfficeBox | nvarchar (20) |  |  |
 | Address1_ShippingMethodCode | int (picklist) |  |  |
 | Address1_ShippingMethodCodeName2 | nvarchar (200) (picklist) |  |  |
 | Address1_Telephone1 | nvarchar (50) |  |  |
 | Address1_Telephone2 | nvarchar (50) |  |  |
 | Address1_Telephone3 | nvarchar (50) |  |  |
 | Address1_UPSZone | nvarchar (4) |  |  |
 | Address2_AddressTypeCode | int (picklist) |  |  |
 | Address2_AddressTypeCodeName2 | nvarchar (200) (picklist) |  |  |
 | Address2_County | nvarchar (50) |  |  |
 | Address2_Fax | nvarchar (20) |  |  |
 | Address2_Latitude | float |  |  |
 | Address2_Longitude | float |  |  |
 | Address2_Name | nvarchar (200) |  |  |
 | Address2_PostOfficeBox | nvarchar (20) |  |  |
 | Address2_ShippingMethodCode | int (picklist) |  |  |
 | Address2_ShippingMethodCodeName2 | nvarchar (200) (picklist) |  |  |
 | Address2_Telephone1 | nvarchar (50) |  |  |
 | Address2_Telephone2 | nvarchar (50) |  |  |
 | Address2_Telephone3 | nvarchar (50) |  |  |
 | Address2_UPSZone | nvarchar (4) |  |  |
CustomerId | ContactId | int | Relationship |  |
 | ContactIdName2 | nvarchar (160) |  |  |
 | AccountId | int | Relationship |  |
 | AccountIdName2 | nvarchar (160) |  |  |
 | EmailAddress2 | nvarchar (100) |  |  |
 | EmailAddress3 | nvarchar (100) |  |  |
 | EstimatedCloseDate3 | datetime |  |  |
 | EstimatedValue | float |  |  |
 | MiddleName | nvarchar (50) |  |  |
 | FullName | nvarchar (160) |  |  |
 | PriorityCode | int (picklist) |  |  |
 | PriorityCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | SalesStageCode | int (picklist) |  |  |
 | SalesStageCodeName2 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | Address1_UTCOffset | int |  |  |
 | Address2_UTCOffset | int |  |  |
 | YomiFirstName | nvarchar (150) |  |  |
 | YomiFullName | nvarchar (450) |  |  |
 | YomiLastName | nvarchar (150) |  |  |
 | YomiMiddleName | nvarchar (150) |  |  |
Not migrated | IsPrivate |  |  |  |
 | Address1_AddressId |  |  |  |
 | Address2_AddressId |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | VersionNumber |  |  |  |
 | CustomerId |  |  |  |
 | CustomerIdType |  |  |  |
 | OwnerId |  |  |  |
 | OwnerIdType |  |  |  |
 | OwningTeam |  |  |  |
 | ParticipatesInWorkflow |  |  |  |
 | SecurityDescriptor |  |  |  |

1 See StateCode and StatusCode Values.

2 The field is used only in the CDF databse; it is not migrated.

3 Values for all attributes of type datetime must be in Coordinated Universal Time (UTC) format CCYY-MM-DD, where CC is the century (00-99), YY is the year (00-99), MM is the month (01-12), and DD is the day of month (01-31), for example, 2003-09-05. If a time is included, it is migrated as the Greenwich Mean Time (GMT) time.


cdf_Opportunity Table

Data in the cdf_Opportunity table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Opportunity table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Opportunity attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | OpportunityId | int (PK) | Required |  |
 | StateCode1 | int (state) |  | 0 (Open) 1 (Won) 2 (Lost) | 0
General tab |  |  |  |  |
Price List | PriceLevelId | int | Relationship |  |
 | PriceLevelIdName1 | nvarchar (100) |  |  |
Topic | Name | nvarchar (300) |  |  |
Potential Customer | ContactId | int | Required 2 , Relationship |  |
 | ContactIdName1 | nvarchar (160) |  |  |
 | AccountId | int | Required 2 , Relationship |  |
 | AccountIdName1 | nvarchar (160) |  |  |
Revenue | IsRevenueSystemCalculated | bit |  | 0 (User Provided)/ 1 (System Calculated) | 1
Est. Revenue | EstimatedValue | money |  |  |
Est. Close Date | EstimatedCloseDate3 | datetime |  |  |
Probability | CloseProbability | int |  |  |
Rating | OpportunityRatingCode | int (picklist) |  |  | 2
 | OpportunityRatingCodeName1 | nvarchar (200) picklist |  | Hot Warm Cold | Warm
Description | Description | ntext |  |  |
Administration tab |  |  |  |  |
Owner | OwningUser | int | Required, Relationship |  |
 | OwningUserName1 | nvarchar (255) |  |  |
Status Reason | StatusCode | int (status) |  | 1 (In Progress) 2 (On Hold) 3 (Won) 4 (Canceled) 5 (Out-Sold) | For StateCode 0, 1 For StateCode 1,3 For StateCode 2, 4
Originating Lead | OriginatingLeadId | int | Relationship |  |
 | OriginatingLeadIdName1 | nvarchar (160) |  |  |
Not on tab by default |  |  |  |  |
Actual Close Date | ActualCloseDate3 | datetime |  |  |
Actual Revenue | ActualRevenue | money |  |  |
Priority Code | PriorityCode | int (picklist) |  |  |
 | PriorityCodeName1 | nvarchar (200) picklist |  |  |
Sales Stage Code | SalesStageCode | int (picklist) |  |  |
 | SalesStageCodeName1 | nvarchar (200) picklist |  |  |
Step Name | StepName | nvarchar (300) |  |  |
Not migrated |  |  |  |  |
 | DiscountPercentage |  |  |  |
 | IsPrivate |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | CustomerId |  |  |  |
 | CustomerIdType |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | OwnerId |  |  |  |
 | OwnerIdType |  |  |  |
 | OwningTeam |  |  |  |
 | ParticipatesInWorkflow |  |  |  |
 | StepId |  |  |  |
 | SecurityDescriptor |  |  |  |
 | VersionNumber |  |  |  |

1 The field is used only in the CDF database; it is not migrated.

2 Either AccountId or ContactId is required.

3 Values for all attributes of type datetime must be in Coordinated Universal Time (UTC) format CCYY-MM-DD, where CC is the century (00-99), YY is the year (00-99), MM is the month (01-12), and DD is the day of month (01-31), for example, 2003-09-05. If a time is included, it is migrated as the Greenwich Mean Time (GMT) time.


cdf_OpportunityProduct Table

Data in the cdf_OpportunityProduct table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_OpportunityProduct table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM OpportunityProduct attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | OpportunityProductId | int (PK) | Required |  |
 | OpportunityId | int | Required, Relationship |  |
 | OpportunityIdName1 | nvarchar (300) |  |  |
General tab |  |  |  |  |
Product | ProductId | int | Required, Relationship |  |
 | ProductIdName1 | nvarchar (100) |  |  |
Unit | UoMId | int | Relationship |  |
 | UoMIdName1 | nvarchar (100) |  |  |
Price Per Unit | PricePerUnit2 | money |  |  |
Quantity | Quantity | decimal 9 (18,5) |  |  |
Amount | BaseAmount2 | money |  |  |
Not on tab by default | Description | ntext |  |  |
 | ExtendedAmount2 | money |  |  |
 | IsPriceOverridden | bit |  | 0 (False) 1 (True) | 1
 | IsProductOverridden | bit |  | 0 (False) 1 (True) | 1
 | ManualDiscountAmount | money |  |  |
 | PricingErrorCode | int (picklist) |  |  |
 | PricingErrorCodeName1 | nvarchar(200) picklist |  |  |
 | ProductDescription | nvarchar (500) |  |  |
 | Tax | money |  |  |
 | VolumeDiscountAmount2 | money |  |  |
Not migrated |  |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |

1 The field is used only in the CDF database; it is not migrated.

2 This is a calculated attribute in Microsoft CRM. Because Microsoft CRM calculates the value, data in this attribute is not migrated.


cdf_PriceLevel Table

Data in the cdf_PriceLevel table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_PriceLevel table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM PriceLevel attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | PriceLevelId | int (PK) | Required |  |
 | StateCode1 | int (state) |  | 0 (Active) 1 (Inactive) | 0
General tab |  |  |  |  |
Name | Name | nvarchar (100) | Required |  |
Description | Description | ntext |  |  |
Start Date | BeginDate2 | datetime |  |  |
End Date | EndDate2 | datetime |  |  |
Not on tab by default | ShippingMethodCode | int |  |  |
 | ShippingMethodCodeName3 | nvarchar (200) |  |  |
 | PaymentMethodCode | int |  |  |
 | PaymentMethodCodeName3 | nvarchar (200) |  |  |
 | FreightTermsCode | int |  |  |
 | FreightTermsCodeName3 | nvarchar (200) |  |  |
Not migrated | StatusCode |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | SecurityDescriptor |  |  |  |
 | VersionNumber |  |  |  |

1 See StateCode and StatusCode Values.

2 Values for all attributes of type datetime must be in Coordinated Universal Time (UTC) format CCYY-MM-DD, where CC is the century (00-99), YY is the year (00-99), MM is the month (01-12), and DD is the day of month (01-31), for example, 2003-09-05. If a time is included, it is migrated as the Greenwich Mean Time (GMT) time.

3 The field is used only in the CDF database; it is not migrated.


cdf_Product Table

Data in the cdf_Product table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Product table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Product attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | ProductId | int (PK) | Required |  |
 | StateCode1 | int (state) |  | 0 (Active) 1 (Inactive) | 0
General tab |  |  |  |  |
ID | ProductNumber | nvarchar (100) | Required |  |
Name | Name | nvarchar (100) | Required |  |
Subject | SubjectId | int | Relationship |  |
 | SubjectIdName2 | nvarchar (500) |  |  |
Unit Group | DefaultUoMScheduleId | int | Relationship |  |
 | DefaultUoMScheduleIdName2 | nvarchar (200) |  |  |
Default Unit | DefaultUoMId | int | Relationship |  |
 | DefaultUoMIdName1 | nvarchar (100) |  |  |
Product Type | ProductTypeCode | int (picklist) |  |  | 1
 | ProductTypeCodeName2 | nvarchar (200) (picklist) |  | Sales Inventory Miscellaneous Charges Services Flat Fees | Sales Inventory
Quantity on Hand | QuantityonHand | decimal 9 (18,5) |  |  |
URL | ProductURL | nvarchar (255) |  |  |
Default Price List | PriceLevelId | int | Relationship |  |
 | PriceLevelIdName2 | nvarchar (100) |  |  |
Decimals Supported | QuantityDecimal | int |  |  | 0
List Price | Price | money |  |  |
Standard Cost | StandardCost | money |  |  |
Current Cost | CurrentCost | money |  |  |
Description tab |  |  |  |  |
Vendor | VendorName | nvarchar (100) |  |  |
Vendor Part Number | VendorPartNumber | nvarchar (100) |  |  |
Stock Weight | StockWeight | decimal 9 (18,5) |  |  |
Stock Volume | StockVolume | decimal 9 (18,5) |  |  |
Description | Description | ntext |  |  |
Not on tab by default | IsStockItem | bit |  | 0 (False) 1 (True) | 1
 | Size | nvarchar (200) |  |  |
 | IsKit | bit |  | 0 (False) 1 (True) | 1
Status Reason | StatusCode1 | int (status) |  | 1 (Active) | For StateCode 0, 1
 |  |  |  | 2 (Inactive) | For StateCode 1, 2
 | SupplierName | nvarchar (100) |  |  |
Not migrated |  |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | SecurityDescriptor |  |  |  |
 | VersionNumber |  |  |  |

1 See StateCode and StatusCode Values.

2 The field is used only in the CDF database; it is not migrated.


cdf_ProductPriceLevel Table

Data in the cdf_ProductPriceLevel table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_ProductPriceLevel table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM ProductPriceLevel attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | ProductPriceLevelId | int (PK) | Required |  |
 | UoMScheduleId | int | Relationship |  |
 | UoMScheduleIdName1 | nvarchar (200) |  |  |
General tab |  |  |  |  |
Price List | PriceLevelId | int | Required, Relationship |  |
 | PriceLevelIdName1 | nvarchar (100) |  |  |
Unit | UoMId | int | Relationship |  |
 | UoMIdName1 | nvarchar (100) |  |  |
Discount List | DiscountTypeId | int | Relationship |  |
 | DiscountTypeIdName1 | nvarchar (100) |  |  |
Product | ProductId | int | Required, Relationship |  |
 | ProductIdName1 | nvarchar (100) |  |  |
Quantity Selling Option | QuantitySellingCode | int (picklist) |  |  |
 | QuantitySellingCodeName1 | nvarchar (200) (picklist) |  | No Control Whole Whole and Fractional | Null
Pricing Method | PricingMethodCode | int (picklist) |  |  | 1
 | PricingMethodCodeName1 | nvarchar (200) (picklist) |  | Currency Amount Percent of List Percent Markup - Current Cost Percent Margin - Current Cost Percent Markup - Standard Cost Percent Margin - Standard Cost | Currency Amount
Amount ($) | Amount | money |  |  |
Percentage | Percentage | decimal 9 (10,5) |  |  |
Rounding Policy | RoundingPolicyCode | int (picklist) |  |  |
 | RoundingPolicyCodeName1 | nvarchar (200) (picklist) |  | None Up Down To Nearest | Null
Rounding Option | RoundingOptionCode | int (picklist) |  |  |
 | RoundingOptionCodeName1 | nvarchar (200) (picklist) |  | Ends in Multiple of | Null
Rounding Amount ($) | RoundingOptionAmount | money |  |  |
Not migrated | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | VersionNumber |  |  |  |

1 The field is used only in the CDF database; it is not migrated.


cdf_Quote Table

Data in the cdf_Quote table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Quote table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Quote attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | QuoteId | int (PK) | Required |  |
 | StateCode1 | int (state) |  | 0 (Draft) | 0
 |  |  |  | 1 (Active) 2 (Won) 3 (Closed) | 1
General tab |  |  |  |  |
Quote ID | QuoteNumber | nvarchar (100) | Required |  |
Name | Name | nvarchar (300) |  |  |
Potential Customer | AccountId | int | Required2 , Relationship |  |
 | AccountIdName3 | nvarchar (160) |  |  |
 | ContactId | int | Required2 , Relationship |  |
 | ContactIdName3 | nvarchar (160) |  |  |
Revision ID | RevisionNumber | int | Required |  |
Price List | PriceLevelId | int | Relationship |  |
 | PriceLevelIdName3 | nvarchar (100) |  |  |
Detail Amount ($) | TotalLineItemAmount4 | money |  |  |
Quote Discount (%) | DiscountPercentage | decimal 10 (10,5) |  |  |
Quote Discount ($) | DiscountAmount | money |  |  |
Pre-Freight Amount ($) | TotalAmountLessFreight4 | money |  |  |
Freight Amount ($) | FreightAmount | money |  |  |
Total Tax ($) | TotalTax4 | money |  |  |
Total Amount ($) | TotalAmount4 | money |  |  |
Shipping tab |  |  |  |  |
Effective From | EffectiveFrom5 | datetime |  |  |
Effective To | EffectiveTo5 | datetime |  |  |
Requested Delivery Date | RequestDeliveryBy5 | datetime |  |  |
Due By | ExpiresOn5 | datetime |  |  |
Shipping Method | ShippingMethodCode | int (picklist) |  |  |
 | ShippingMethodCodeName3 | nvarchar (200) (picklist) |  | Airborne DHL FedEx UPS Postal Mail Full Load Will Call | Null
Payment Terms | PaymentTermsCode | int (picklist) |  |  |
 | PaymentTermsCodeName3 | nvarchar (200) (picklist) |  | Net 30 2%10, Net 30 Net 45 Net 60 | Null
Freight Terms | FreightTermsCode | int (picklist) |  |  |
 | FreightTermsCodeName3 | nvarchar (200) (picklist) |  | FOB No Charge | Null
Description | Description | ntext |  |  |
Addresses tab |  |  |  |  |
Name (Bill To) | BillTo_Name | nvarchar (200) |  |  |
Street 1 | BillTo_Line1 | nvarchar (50) |  |  |
Street 2 | BillTo_Line2 | nvarchar (50) |  |  |
Street 3 | BillTo_Line3 | nvarchar (50) |  |  |
City | BillTo_City | nvarchar (50) |  |  |
State/Province | BillTo_StateOrProvince | nvarchar (50) |  |  |
ZIP/Postal Code | BillTo_PostalCode | nvarchar (20) |  |  |
Country/Region | BillTo_Country | nvarchar (50) |  |  |
Phone | BillTo_Telephone | nvarchar (50) |  |  |
Fax | BillTo_Fax | nvarchar (20) |  |  |
Ship To | WillCall | bit |  | 0 (Address) 1 (Will Call) | 0
Name (Ship To) | ShipTo_Name | nvarchar (200) |  |  |
Street 1 | ShipTo_Line1 | nvarchar (50) |  |  |
Street 2 | ShipTo_Line2 | nvarchar (50) |  |  |
Street 3 | ShipTo_Line3 | nvarchar (50) |  |  |
City | ShipTo_City | nvarchar (50) |  |  |
State/Province | ShipTo_StateOrProvince | nvarchar (50) |  |  |
ZIP/Postal Code | ShipTo_PostalCode | nvarchar (20) |  |  |
Country/Region | ShipTo_Country | nvarchar (50) |  |  |
Phone | ShipTo_Telephone | nvarchar (50) |  |  |
Fax | ShipTo_Fax | nvarchar (20) |  |  |
Administration tab |  |  |  |  |
Owner | OwningUser | int | Required, Relationship |  |
 | OwningUserName3 | nvarchar (255) |  |  |
Opportunity | OpportunityId | int | Relationship |  |
 | OpportunityIdName3 | nvarchar (300) |  |  |
Status Reason | StatusCode1 | int (status) |  | 1 (In Progress) | For StateCode 0, 1
 |  |  |  | 2 (In Progress) 3 (Open) | For StateCode 1, 2
 |  |  |  | 4 (Won) | For StateCode 2, 4
 |  |  |  | 5 (Lost) 6 (Canceled) 7 (Revised) | For StateCode 3, 5
Not on tab by default | ClosedOn5 | datetime |  |  |
 | ShipTo_FreightTermsCode | int (picklist) |  |  |
 | ShipTo_FreightTermsCodeName3 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | TotalDiscountAmount4 | money |  |  |
 | TotalLineItemDiscountAmount4 | money |  |  |
Not migrated | OwningBusinessUnitIdName |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | VersionNumber |  |  |  |
 | CustomerId |  |  |  |
 | CustomerIdType |  |  |  |
 | OwnerId |  |  |  |
 | OwnerIdType |  |  |  |
 | OwningTeam |  |  |  |
 | SecurityDescriptor |  |  |  |

1 See StateCode and StatusCode Values.

2 Either AccountId or ContactId is required.

3 The field is used only in the CDF database; it is not migrated.

4 This is a calculated attribute in Microsoft CRM. Because Microsoft CRM calculates the value, data in this attribute is not migrated.

5 Values for all attributes of type datetime must be in Coordinated Universal Time (UTC) format CCYY-MM-DD, where CC is the century (00-99), YY is the year (00-99), MM is the month (01-12), and DD is the day of month (01-31), for example, 2003-09-05. If a time is included, it is migrated as the Greenwich Mean Time (GMT) time.


cdf_QuoteDetail Table

Data in the cdf_QuoteDetail table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_QuoteDetail table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM QuoteDetail attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | QuoteDetailId | int (PK) | Required |  |
 | QuoteId |  | Required, Relationship |  |
 | QuoteStateCode | int (state) |  |  |
 | QuoteStateCodeName1 | nvarchar (200) |  |  |
General tab |  |  |  |  |
Select Product | IsProductOverridden | bit |  | 0 (Existing) 1 (Write In) | 0
Product | ProductId | int | Relationship |  |
 | ProductIdName1 | nvarchar (100) |  |  |
Product Description | ProductDescription | nvarchar (500) |  |  |
Unit | UoMId | int | Relationship |  |
 | UoMIdName1 | nvarchar (100) |  |  |
Pricing | IsPriceOverridden | bit |  | 0 (Use Default) 1 (Overrride Price) | 0
Price Per Unit | PricePerUnit | money |  |  |
Volume Discount ($) | VolumeDiscountAmount2 | money |  |  |
Quantity | Quantity | decimal 9 (18,5) |  |  |
Amount | BaseAmount2 | money |  |  |
Manual Discount ($) | ManualDiscountAmount | money |  |  |
Tax | Tax | money |  |  |
Extended Amount ($) | ExtendedAmount2 | money |  |  |
Delivery tab |  |  |  |  |
Requested Date | RequestDeliveryBy3 | datetime |  |  |
Salesperson | SalesRepId | int | Relationship |  |
 | SalesRepIdName1 | nvarchar (160) |  |  |
Address tab |  |  |  |  |
Ship To | WillCall | bit |  | 0 (Address) 1 (Will Call) | 0
Name | ShipTo_Name | nvarchar (200) |  |  |
Street 1 | ShipTo_Line1 | nvarchar (50) |  |  |
Street 2 | ShipTo_Line2 | nvarchar (50) |  |  |
Street 3 | ShipTo_Line3 | nvarchar (50) |  |  |
City | ShipTo_City | nvarchar (50) |  |  |
State/Province | ShipTo_StateOrProvince | nvarchar (50) |  |  |
ZIP/Postal Code | ShipTo_PostalCode | nvarchar (20) |  |  |
Country/Region | ShipTo_Country | nvarchar (50) |  |  |
Phone | ShipTo_Telephone | nvarchar (50) |  |  |
Fax | ShipTo_Fax | nvarchar (20) |  |  |
Freight Terms | ShipTo_FreightTermsCode | int (picklist) |  |  |
 | ShipTo_FreightTermsCodeName1 | nvarchar (200) (picklist) |  | FOB No Charge | Null
Not on tab by default | Description | ntext |  |  |
 | PricingErrorCode | int (picklist) |  |  |
 | PricingErrorCodeName1 | nvarchar (200) (picklist) |  |  |
 | LineItemNumber | int |  |  |
Not migrated |  |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | DeletionStateCode |  |  |  |

1 The field is used only in the CDF database; it is not migrated.

2 This is a calculated attribute in Microsoft CRM. Because Microsoft CRM calculates the value, data in this attribute is not migrated.

3 Values for all attributes of type datetime must be in Coordinated Universal Time (UTC) format CCYY-MM-DD, where CC is the century (00-99), YY is the year (00-99), MM is the month (01-12), and DD is the day of month (01-31), for example, 2003-09-05. If a time is included, it is migrated as the Greenwich Mean Time (GMT) time.


cdf_SalesOrder Table

Data in the cdf_SalesOrder table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_SalesOrder table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM SalesOrder attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | SalesOrderId | int (PK) | Required |  |
 | StateCode1 | int (state) |  | 0 (Active) 1 (Submitted) 2 (Canceled) | (0) Active
General tab |  |  |  |  |
Order ID | OrderNumber | nvarchar (100) | Required |  |
Name | Name | nvarchar (300) |  |  |
Customer | AccountId | int | Required2 , Relationship |  |
 | AccountIdName3 | nvarchar (160) |  |  |
 | ContactId | int | Required2 , Relationship |  |
 | ContactIdName3 | nvarchar (160) |  |  |
Price List | PriceLevelId | int | Relationship |  |
 | PriceLevelIdName3 | nvarchar (100) |  |  |
Detail Amount ($) | TotalLineItemAmount4 | money |  |  |
Order Discount (%) | DiscountPercentage | decimal 9 (10,5) |  |  |
Order Discount ($) | DiscountAmount | money |  |  |
Pre-Freight Amount ($) | TotalAmountLessFreight4 | money |  |  |
Freight Amount ($) | FreightAmount | money |  |  |
Total Tax ($) | TotalTax4 | money |  |  |
Total Amount ($) | TotalAmount4 | money |  |  |
Shipping tab |  |  |  |  |
Requested Delivery Date | RequestDeliveryBy5 | datetime |  |  |
Shipping Method | ShippingMethodCode | int (picklist) |  |  |
 | ShippingMethodCodeName3 | nvarchar (200) (picklist) |  | Airborne DHL FedEx UPS Postal Mail Full Load Will Call | Null
Payment Terms | PaymentTermsCode | int (picklist) |  |  |
 | PaymentTermsCodeName3 | nvarchar (200) (picklist) |  | Net 30 2%10, Net 30 Net 45 Net 60 | Null
Freight Terms | FreightTermsCode | int (picklist) |  |  |
 | FreightTermsCodeName3 | nvarchar (200) (picklist) |  | FOB No Charge | Null
Description | Description | ntext |  |  |
Addresses tab |  |  |  |  |
Name (Bill To) | BillTo_Name | nvarchar (200) |  |  |
Street 1 | BillTo_Line1 | nvarchar (50) |  |  |
Street 2 | BillTo_Line2 | nvarchar (50) |  |  |
Street 3 | BillTo_Line3 | nvarchar (50) |  |  |
City | BillTo_City | nvarchar (50) |  |  |
State/Province | BillTo_StateOrProvince | nvarchar (50) |  |  |
ZIP/Postal Code | BillTo_PostalCode | nvarchar (20) |  |  |
Country/Region | BillTo_Country | nvarchar (50) |  |  |
Phone | BillTo_Telephone | nvarchar (50) |  |  |
Fax | BillTo_Fax | nvarchar (20) |  |  |
Ship To | WillCall | bit |  | 0 (Address) 1 (Will Call) | 0
Name (Ship To) | ShipTo_Name | nvarchar (200) |  |  |
Street 1 | ShipTo_Line1 | nvarchar (50) |  |  |
Street 2 | ShipTo_Line2 | nvarchar (50) |  |  |
Street 3 | ShipTo_Line3 | nvarchar (50) |  |  |
City | ShipTo_City | nvarchar (50) |  |  |
State/Province | ShipTo_StateOrProvince | nvarchar (50) |  |  |
ZIP/Postal Code | ShipTo_PostalCode | nvarchar (20) |  |  |
Country/Region | ShipTo_Country | nvarchar (50) |  |  |
Phone | ShipTo_Telephone | nvarchar (50) |  |  |
Fax | ShipTo_Fax | nvarchar (20) |  |  |
Freight Terms | ShipTo_FreightTermsCode | int (picklist) |  |  |
 | ShipTo_FreightTermsCodeName3 | nvarchar (200) (picklist) |  | FOB No Charge | Null
Administration tab |  |  |  |  |
Owner | OwningUser | int | Required, Relationship |  |
 | OwningUserName3 | nvarchar (255) |  |  |
Status Reason | StatusCode1 | int (status) |  | 1 (New) 2 (Pending) | For StateCode 0, 1
 |  |  |  | 3 (In Progress) | For StateCode 1, 3
 |  |  |  | 4 (No Money) | For StateCode 2, 4
Opportunity | OpportunityId | int | Relationship |  |
 | OpportunityIdName3 | nvarchar (300) |  |  |
Quote | QuoteId | int |  |  |
 | QuoteIdName3 | nvarchar (300) |  |  |
Not on tab by default | LastBackOfficeSubmit5 | datetime |  |  |
 | PricingErrorCode | int |  |  |
 | PricingErrorCodeName3 | nvarchar (200) (picklist) |  |  |
 | PriorityCode | int (picklist) |  |  |
 | PriorityCodeName3 | nvarchar (200) (picklist) |  | Default Value | Default Value
 | SubmitDate5 | datetime |  |  |
 | SubmitStatus | int |  |  |
 | SubmitStatusDescription | ntext |  |  |
 | TotalDiscountAmount4 | money |  |  |
 | TotalLineItemDiscountAmount4 | money |  |  |
Not migrated |  |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | OwnerId |  |  |  |
 | OwnerIdType |  |  |  |
 | OwningTeam |  |  |  |
 | SecurityDescriptor |  |  |  |
 | VersionNumber |  |  |  |

1 See StateCode and StatusCode Values.

2 Either AccountId or ContactId is required.

3 The field is used only in the CDF database; it is not migrated.

4 This is a calculated attribute in Microsoft CRM. Because Microsoft CRM calculates the value, data in this attribute is not migrated.

5 Values for all attributes of type datetime must be in Coordinated Universal Time (UTC) format CCYY-MM-DD, where CC is the century (00-99), YY is the year (00-99), MM is the month (01-12), and DD is the day of month (01-31), for example, 2003-09-05. If a time is included, it is migrated as the Greenwich Mean Time (GMT) time.


cdf_SalesOrderDetail Table

Data in the cdf_SalesOrderDetail table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_SalesOrderDetail table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM SalesOrderDetail attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | SalesOrderDetailId | int (PK) | Required |  |
 | SalesOrderId | int | Required, Relationship |  |
 | SalesOrderStateCode | int |  |  |
 | SalesOrderStateCodeName1 | nvarchar (200) |  |  |
General tab |  |  |  |  |
Select Product | IsProductOverridden | bit |  | 0 (Existing) 1 (Write In) | 0
Product | ProductId | int | Relationship |  |
 | ProductIdName1 | nvarchar (100) |  |  |
Product Description | ProductDescription | nvarchar (500) |  |  |
Unit | UoMId | int | Relationship |  |
 | UoMIdName1 | nvarchar (100) |  |  |
Pricing | IsPriceOverridden | bit |  | 0 (Use Default) 1 (Override Price) | 0
Price Per Unit | PricePerUnit | money |  |  |
Volume Discount ($) | VolumeDiscountAmount2 | money |  |  |
Quantity | Quantity | decimal 9 (18,5) |  |  |
Amount | BaseAmount2 | money |  |  |
Manual Discount ($) | ManualDiscountAmount | money |  |  |
Tax | Tax | money |  |  |
Extended Amount ($) | ExtendedAmount2 | money |  |  |
Delivery tab |  |  |  |  |
Requested Date | RequestDeliveryBy3 | datetime |  |  |
Salesperson | SalesRepId | int | Relationship |  |
 | SalesRepIdName1 | nvarchar (160) |  |  |
Shipped | QuantityShipped | decimal 9 (18,5) |  |  |
Back Ordered | QuantityBackOrdered | decimal 9 (18,5) |  |  |
Cancelled | QuantityCancelled | decimal 9 (18,5) |  |  |
Address tab |  |  |  |  |
Ship To | WillCall | bit |  | 0 (Address) 1 (Will Call) | 0
Name | ShipTo_Name | nvarchar (200) |  |  |
Street 1 | ShipTo_Line1 | nvarchar (50) |  |  |
Street 2 | ShipTo_Line2 | nvarchar (50) |  |  |
Street 3 | ShipTo_Line3 | nvarchar (50) |  |  |
City | ShipTo_City | nvarchar (50) |  |  |
State/Province | ShipTo_StateOrProvince | nvarchar (50) |  |  |
ZIP/Postal Code | ShipTo_PostalCode | nvarchar (20) |  |  |
Country/Region | ShipTo_Country | nvarchar (50) |  |  |
Phone | ShipTo_Telephone | nvarchar (50) |  |  |
Fax | ShipTo_Fax | nvarchar (20) |  |  |
Freight Terms | ShipTo_FreightTermsCode | int (picklist) |  |  |
 | ShipTo_FreightTermsCodeName1 | nvarchar (200) (picklist) |  | FOB No Charge | Null
Not on tab by default |  |  |  |  |
 | Description | ntext |  |  |
 | IsCopied | bit |  | 0 (False) 1 (True) | 1
 | PricingErrorCode | int (picklist) |  |  |
 | PricingErrorCodeName1 | nvarchar (200) (picklist) |  |  |
 | LineItemNumber | int |  |  |
Not migrated |  |  |  |  |
 | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |

1 The field is used only in the CDF database; it is not migrated.

2 This is a calculated attribute in Microsoft CRM. Because Microsoft CRM calculates the value, data in this attribute is not migrated.

3 Values for all attributes of type datetime must be in Coordinated Universal Time (UTC) format CCYY-MM-DD, where CC is the century (00-99), YY is the year (00-99), MM is the month (01-12), and DD is the day of month (01-31), for example, 2003-09-05. If a time is included, it is migrated as the Greenwich Mean Time (GMT) time.


cdf_Subject Table

Data in the cdf_Subject table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Subject table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Subject attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | SubjectId | int (PK) | Required |  |
 | FeatureMask | int |  |  |
Subject |  |  |  |  |
Title | Title | nvarchar (500) |  |  |
Parent Subject | ParentSubject | int | Relationship |  |
 | ParentSubjectName1 | nvarchar (500) |  |  |
Description | Description | ntext |  |  |
Not migrated | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | SecurityDescriptor |  |  |  |
 | VersionNumber |  |  |  |

1 The field is used only in the CDF database; it is not migrated.


cdf_Uom Table

Data in the cdf_Uom table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_Uom table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM Uom attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | UoMId | int (PK) | Required |  |
 | UoMScheduleId | int | Required, Relationship |  |
 | UoMScheduleIdName1 | nvarchar (200) |  |  |
 | IsScheduleBaseUoM | bit |  | 0 (False) 1 (True) | 0
General tab |  |  |  |  |
Base Unit | BaseUoM | int | Relationship |  |
 | BaseUoMName1 | nvarchar (100) |  |  |
Name | Name | nvarchar (100) |  |  |
Quantity | Quantity | decimal 9 (18,5) |  |  |
Not migrated | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |

1 The field is used only in the CDF database; it is not migrated.


cdf_UomSchedule Table

Data in the cdf_UomSchedule table must meet the migration criteria specified in Data Requirements for Migration. The following table shows all of the attributes in Microsoft CRM that can be migrated from the cdf_UomSchedule table and the respective attribute names and types in the CDF database. The table also shows whether the attribute is required and whether it is used to create a relationship with other entities. For drop-down lists and Boolean attributes, the table shows the valid values and the default value in Microsoft CRM. The last rows of the table list the Microsoft CRM UomSchedule attributes that cannot be migrated using the Microsoft CRM Data Migration Framework.

Microsoft CRM tab name and attribute label | CDF attribute name | CDF type | Required or Relationship in CDF | Microsoft CRM values | Default Microsoft CRM value
Not on tab | UoMScheduleId | int (PK) | Required |  |
General tab |  |  |  |  |
Name | Name | nvarchar (200) | Required |  |
Description | Description | ntext |  |  |
Not migrated | CreatedBy |  |  |  |
 | CreatedOn |  |  |  |
 | DeletionStateCode |  |  |  |
 | ModifiedBy |  |  |  |
 | ModifiedOn |  |  |  |
 | SecurityDescriptor |  |  |  |
 | VersionNumber |  |  |  |


Entity Information Table (cdf_<entity>_info) Fields

Entity information tables (cdf_<entity>_info) contain the migration information for the entities you migrate to Microsoft CRM. There is one record in the entity information table for each record in the associated entity base table. When a record is inserted or deleted in an entity base table, a trigger automatically adds the associated record to or deletes the associated record from the entity information table to keep the data synchronized between the two tables.

If you want to track the connection between your data source and where the data ended up in Microsoft CRM, you can load each record of the entity information table with the source name, source entity name, and the source identifier both as a string and as an integer. The source strings are not migrated but they provide you with the ability to trace each record from Microsoft CRM back to your source system.

The CDF Migration Tool adds the destination GUID from Microsoft CRM in the DestinationID attribute in the entity information table when the record has been migrated successfully. The GUID data is useful for tracking what records have been migrated successfully—if the record does not have a GUID, it was not migrated. You can also use the GUID to find the record in Microsoft CRM.

The following table shows the attributes in the cdf_<entity>_info tables.

cdf_<entity>_Info attribute | Description of attribute
<Entity>Id | Primary key for the table.
SourceSystemName | Name of the source system (for example, ACT, GoldMine). The migration tools do not use this attribute, but you can use it as a reference in case you later need to look up where data came from in your source system.
SourceEntityName | Name of the table in the source system where the data originates. It can be used to distinguish entities coming from different source systems or different databases of the same source system (for example, Contact_1). The migration tools do not use this attribute, but you can use it as a reference in case you later need to look up where data came from in your source system.
SourceIdStr | Identifier of the source object in the form of a string, (for example, AdvWks-3 for a source database that uses a combination of characters and numbers in the identifier attribute). The migration tools do not use this attribute, but you can use it as a reference in case you later need to look up where data came from in your source system.
SourceIdInt | Identifier of the source object in the form of an integer (for example, 3). The migration tools do not use this attribute, but you can use it as a reference in case you later need to look up where data came from in your source system.
DestinationSystemName | Name of the destination. The default value for this attribute is Microsoft CRM. Important Do not change this value.
DestinationEntityName | The name of the Microsoft CRM entity to which this data is migrated. This attribute value is the name of the entity represented in the entity information table name (for example, in the cdf_account_info table, this attribute value is account). Important Do not change this value.
DestinationId | The Microsoft CRM GUID. The CDF Migration Tool populates this attribute after the record has been migrated. You can use this attribute to track what records have been successfully migrated.
StatusCode | Status indicates the success or failure codes during the migration of this object. This attribute is used only by the CDF Migration Tool. Do not change it.
IsLinked | [Reserved for future use.]


Entity Extension Table (cdf_<entity>_ext) Fields

Entity extension (cdf_<entity>_ext) tables exist only for Microsoft CRM entities that are customizable. (For a list of the entities you can customize, see Data That Can Be Migrated.) When a record is inserted or deleted in an entity base table, a trigger automatically adds the associated record to or deletes the associated record from the entity extension table to keep the data synchronized between the two tables. The primary key for a cdf_<entity>_ext table is <entity>Id, which is the same as the primary key for the cdf_<entity> table.

If you have extended the Microsoft CRM schema and run the CDF Initialization Tool, each new attribute you created in Microsoft CRM for the customizable entity will now have an associated attribute in the entity extension table for that entity. You load your custom data into the custom attributes for each record in the entity extension table.

For example, if you add a new date/time attribute called StartDate to the Microsoft CRM Contact form and publish the change, you will see a new attribute in the cdf_contact_ext table called CFDStartDate. (The prefix to the attribute name is added by Microsoft CRM.) There would be one record in the cdf_contact_ext table for each record in the cdf_contact table. For each contact, you would load your start date data into the record in cdf_contact_ext and the rest of your contact data into the record in cdf_contact.

To make it easier to cleanse your data so that it meets Microsoft CRM requirements, the entity extension table includes a string attribute as well as an integer attribute for storing your data for drop-down list attributes. The integer attribute stores the data that is to be migrated; the string attribute stores the string associated with the integer. All <drop-down list> attributes are integers, and each has an associated <drop-down list>Name string attribute.

For example, if you add a drop-down list in Microsoft CRM, two new attributes, CFPSpecializedCategory and CFPSpecializedCategoryName, are added in the entity extension table. You must populate the string attribute when you populate the CDF database with your data; the integer attribute is populated when you complete the process of cleansing your drop-down list data.

Each attribute in each entity extension table has an associated record in the cdf_EntityAttribute table. Only attributes listed in the cdf_EntityAttribute table are migrated. This means you can create your own additional columns in the entity extension tables for tracking information about cleansing data and removing duplicates. Having the extension table separate from the entity base table provides enough space to store your custom field data and any data cleansing information you need.


CDF Database Correlation Tables

The correlation tables are essential for correlating information in the entity tables between the CDF database and Microsoft CRM. They are populated directly from data in Microsoft CRM when you run the CDF Initialization Tool.

Correlation tables | Purpose of tables
SystemUser, Organization, Business Unit, and Territory Tables | These tables are used as a reference during data cleansing so that any data referring to a user, organization name, business unit, or territory refers to the correct information from Microsoft CRM.
Drop-Down List Correlation Tables | Drop-down list data is only migrated if it matches valid drop-down list data in Microsoft CRM. The cdf_StringMapCrm table is used as the reference for the data in Microsoft CRM. The cdf_StringMap table is a temporary table that is used for cleansing your data to match the data in cdf_StringMapCrm.


System User, Organization, Business Unit, and Territory Correlation Tables

Data in many entity base tables references system user, organization, business unit, or territory information. You must transform or cleanse your source data in the entity tables that refer to this information to ensure that only valid data is used. This allows the CDF Migration Tool to maintain the data relationships.

Important Do not enter data directly in the cdf_SystemUser, cdf_BusinessUnit, or cdf_Territory tables because data from these tables will not be migrated into Microsoft CRM. If you find an error or omission in a correlation table, fix the data in Microsoft CRM and then rerun the CDF Initialization Tool.

Correlation table | Purpose of table
cdf_SystemUser | Stores information about the users that you set up in Microsoft CRM.
cdf_SystemUser_info | Tracks whether the users in the CDF database have been correlated with the users that you defined in Microsoft CRM. The CDF Migration Tool adds each user's Microsoft CRM GUID to the DestinationId attribute during the migration process.
cdf_Organization | Stores the organization name that you used in Microsoft CRM Setup.
cdf_Organization _info | Tracks whether the organization in the CDF database has been correlated with the organization that you defined in Microsoft CRM. The CDF Migration Tool adds each organization's Microsoft CRM GUID to the DestinationId attribute during the migration process.
cdf_BusinessUnit | Stores the business units that you defined in Microsoft CRM.
cdf_BusinessUnit_info | Tracks whether the business units in the CDF database have been correlated with the business units that you defined in Microsoft CRM. The CDF Migration Tool adds each business unit's Microsoft CRM GUID to the DestinationId attribute during the migration process.
cdf_Territory | Stores the territories that you defined in Microsoft CRM.
cdf_Territory_info | Tracks whether the territories in the CDF database have been correlated with the territories that you defined in Microsoft CRM. The CDF Migration Tool adds each territory's Microsoft CRM GUID to the DestinationId attribute during the migration process.


Drop-Down List Correlation Tables

Data in drop-down lists must be valid Microsoft CRM values. You must transform or cleanse your source data in the entity tables to ensure that only valid drop-down list values are used. This allows the CDF Migration Tool to migrate your drop-down lists.

To make the process of cleansing drop-down lists easier, there are two correlation tables provided in the CDF database to help organize drop-down list data:

  • cdf_StringMapCrm

When you run the CDF Initialization Tool, the cdf_StringMapCrm table is populated with values and default values for drop-down lists in Microsoft CRM entities that can be migrated with the CDF Migration Tool. It serves as the reference list against which to check your data.

Important Do not enter data directly in the cdf_StringMapCrm table, because data from this table will not be migrated into Microsoft CRM. If you find an error or omission in the table, fix the drop-down list in Microsoft CRM and then rerun the CDF Initialization Tool.

  • cdf_StringMap

The cdf_StringMap table is a temporary table that is populated by a stored procedure with all the values used in your drop-down list attributes in any of your entity tables. Stored procedures are used to cleanse the data in the cdf_StringMap table and to update your entity base and extension tables with valid drop-down list data. For information about the stored procedures used to cleanse drop-down list data, see Appendix A, "CDF Database Stored Procedures" in the Microsoft Business Solutions CRM Data Migration Framework Guide.

The following table shows the attributes in the cdf_StringMapCrm table.

cdf_StringMapCrm attribute | Description of attribute
StringMapId | The unique identifier for each record.
ObjectTypeCode | The number that Microsoft CRM uses for the entity in which the drop-down list is located. To find the entity name or EntityId that is associated with an ObjectTypeCode value, see ObjectTypeCode Values.
AttributeName | The name of the drop-down list attribute.
AttributeValueInt | The index value Microsoft CRM uses for the drop-down list item that is specified in AttributeName.
AttributeValueStr | The string Microsoft CRM uses for the drop-down list item that is specified in AttributeValueInt.
IsDefault | Specifies whether the value is the default for the drop-down list.

The following table shows the attributes in the cdf_StringMap table.

cdf_StringMap attribute | Description of attribute
StringMapId | Attribute that maps to the associated StringMapId attribute in the cdf_StringMapCrm table. It links the values coming from the entity tables (your source data) to Microsoft CRM values.
ObjectTypeCode | The number that Microsoft CRM uses for the entity in which the drop-down list is located. To find the entity name or EntityId that is associated with an ObjectTypeCode value, see ObjectTypeCode Values.
AttributeName | The name of the drop-down list attribute.
AttributeValueStr | The string value in your data for the drop-down list item that is specified in AttributeName. The data in this attribute must match a valid AttributeValueStr attribute in the cdf_StringMapCrm table.


CDF Database MetaData Tables

The CDF database metadata tables ensure version compatibility and also specify and track migration status.

MetaData table | Purpose of table
cdf_BuildVersion Table | The cdf_BuildVersion table is used to ensure that the version of the CDF database is compatible with the version of the CDF Migration Tool and the version of Microsoft CRM. Important Do not change any data in the cdf_BuildVersion table. If you change information in this table, migration will not be supported by Microsoft.
cdf_EntityMigrationInfo Table | For each entity, this table specifies the information about the entity that is required for the migration process. Do not change any data in this table directly. Instead, use the stored procedures provided as part of the Microsoft CRM Data Migration Framework to modify the data. This helps protect you from making changes that will cause your migration to fail.
cdf_EntityAttribute Table | For each attribute, this table specifies the information about the attribute that is required for the migration process. Do not change any data in this table directly. Instead, use the stored procedures provided as part of the Microsoft CRM Data Migration Framework to modify the data. This helps protect you from making changes that will cause your migration to fail.

For information about stored procedures used to control the migration process, see Appendix A, "CDF Stored Procedure Reference," in the Microsoft Business Solutions CRM Data Migration Framework Guide.


cdf_BuildVersion Table

The cdf_BuildVersion table is used to ensure that the version of the CDF database is compatible with the version of the CDF Migration Tool and the version of Microsoft CRM.

Important Do not change any data in the cdf_BuildVersion table. If you change information in this table, migration will not be supported by Microsoft.

The following table shows the attributes in the cdf_BuildVersion table.

cdf_BuildVersion table attribute | Description of attribute
BuildDate | Date that this version of the Microsoft CRM Data Migration Framework was built.
TimeStamp | [Not used.]
BuildNumber | Build number.
BuildQFE | If a hotfix or update has been installed, the number of the hotfix or update.
MajorVersion | Major version number.
MinorVersion | Minor version number.
Revision | Revision number.
LastDatabaseQFE | Short description of the most recent hotfix or update.


cdf_EntityMigrationInfo Table

The cdf_EntityMigrationInfo table specifies information about the migration process for each of the entities.

Do not change this table directly. Instead, use the stored procedures provided as part of the Microsoft CRM Data Migration Framework to modify values in the table. Using the stored procedures helps protect you from making changes that will cause your migration to fail. For more information about the stored procedures, see Appendix A, "CDF Database Stored Procedures," in the Microsoft Business Solutions CRM Data Migration Framework Guide.

The following table shows the attributes in the cdf_EntityMigrationInfo table.

cdf_EntityMigrationInfo table attribute
Description of attribute
EntityId | The primary key for the entity.
EntityName | The name of the entity.
ObjectTypeCode | The number that Microsoft CRM uses for this entity. See ObjectTypeCodeValues.
IsCustomizable | Indicates whether this entity is customizable in Microsoft CRM. Do not change this value.
SourceCount | Specifies the number of records that exist in the CDF database for the entity. After you extract and cleanse your data and then consolidate the data from each data source into the CDF database, run the p_cdf_UpdateSourceCount stored procedure for each entity. This procedure counts the number of records available for the entity for migration and stores the number in this attribute.
TestBatchCount Used in test migrations to set how many records from the entity are to be imported into Microsoft CRM when you run the CDF Migration Tool.

To set the value for TestBatchCount, use the p_cdf_SetTestBatchCount stored procedure.

To reset this attribute when you are done testing and ready to do a full import, use p_cdf_SetTestBatchCount to set this attribute to 0, or use p_cdf_ClearAllTestBatchCounts or p_cdf_Reset to reset TestBatchCount for all entities.
DestinationCount | Specifies the number of records that have been successfully migrated to Microsoft CRM for the entity. This attribute is a count of the DestinationId values in the cdf_<entity>_info table for the entity. It is computed by the CDF Migration Tool during each migration. By comparing this value to the SourceCount value, you can determine the percentage of records successfully migrated.
NotProcessed | Specifies the number of records that are not imported into Microsoft CRM for the entity. The CDF Migration Tool updates this value.
MigrationCode Specifies whether or not this entity should be migrated. By default, all entities except ActivityParty have a MigrationCode of 1, which means they will be migrated. The data for cdf_ActivityParty is migrated as part of migrating cdf_Activity, so it is controlled by the value of MigrationCode for Activity.

If you do not want a specific entity to be migrated, use the p_cdf_SetEntityMigration stored procedure to change the value for that entity to 0.

Note If you change this value, be careful to not break dependencies. For example, if you try to migrate Annotations without migrating the entity with which each annotation is associated, the migration will fail.
MigrationOrder | Specifies the order in which to migrate this entity. The CDF Migration Tool follows the migration order specified by this attribute so that it can preserve dependencies. Changes to values in this attribute are not recommended.


cdf_EntityAttribute Table

The cdf_EntityAttribute table stores the name, label, type, and size of each attribute and the associated entity of the attribute. It also specifies whether the attribute is used to define relationships between entities, whether it is a drop-down list (picklist), whether it is a custom attribute in Microsoft CRM, whether it should be migrated, and its migration status.

Do not change the cdf_EntityAttribute table directly. Instead, use the stored procedures provided as part of the Microsoft CRM Data Migration Framework to modify values in the table. Using the stored procedures helps protect you from making changes that will cause your migration to fail. For more information about the stored procedures, see Appendix A, "CDF Database Stored Procedures," in the Microsoft Business Solutions CRM Data Migration Framework Guide.

The following table shows the attributes in the cdf_EntityAttribute table.

cdf_EntityAttribute table attribute
Description of attribute
EntityId | The identifier for the entity with which this attribute is associated. The identifier is based on the unique EntityId value for the entity from the cdf_EntityMigrationInfo table. Serves as the primary key for the table along with AttributeName.
AttributeName | The name of the attribute.
AttributeLabel | The label of the attribute.
AttributeType | The type of attribute.
AttributeSize | The size of the attribute. This size is determined by the size of the attribute in Microsoft CRM, so Do not change the values in this attribute.
SourceAttributeName | Name of the attribute in the source database.
IsRelationship | Indicates whether this attribute is a relationship. This information is used by the CDF Migration Tool. Do not change the values in this attribute.
IsPicklist | Indicates whether this attribute is a drop-down list (picklist).
IsCRMCustom | Indicates that this is a custom attribute created in Microsoft CRM.
ValidForCreate | Provides data required for the CDF Migration Tool. Do not change the values in this attribute.
ValidForUpdate | Provides data required for the CDF Migration Tool. Do not change the values in this attribute.
IsCorrelation | Indicates that this attribute is used by the CDF Migration Tool to correlate data. Do not change the values in this attribute.
MigrationCode Specifies whether this attribute should be migrated. By default, all attributes other than the primary key for each table have a MigrationCode of 1, which means they will be migrated. If you don't want a specific attribute to be migrated, use the p_cdf_SetAttributeMigration stored procedure to change the value for that attribute to 0.

However, be careful if you change the value of MigrationCode to 0. If you change the value for a required attribute to 0, no records in the entity will be migrated. If you change the value to 0 for an attribute that is used to maintain a dependency with another table, the 0 will be ignored and the data required for the relationship will be migrated.

Note The primary key for each entity table must have a MigrationCode of 0. Do not change this value. The data for the primary key itself will be migrated if you set the MigrationCode for the entity in the cdf_EntityMigrationInfo table to 1.


Data Requirements for Migration

Data in the entity tables must meet the following criteria for migration to succeed.

  • All fields marked as Required must have data.
  • Date/time fields must be in Coordinated Universal Time (UTC).
  • Identifier fields must be integers.
  • If a field is marked IsRelationship and you want it to reference a record in another table, the value of the field must match a valid identifier from the other table.
  • All OwningUser and SalesRepId fields must have valid values from the cdf_SystemUser table.
  • All TerritoryID fields must have valid values from the cdf_Territory table.
  • The value in the integer field for a drop-down list must match a valid drop-down list value in Microsoft CRM. Drop-down lists in the CDF database have two fields: one text field and one integer field. Only the integer field is migrated.
  • StateCode and StatusCode data must be valid Microsoft CRM values. See StateCode and StatusCode Values.

The Microsoft CRM Data Migration Framework has built-in stored procedures to handle data cleansing, but you may be able to meet some of these requirements by using data transformations in your source adapter.

For more information, see Chapter 3, "Determining Your Migration Strategy," and Chapter 6, "Cleansing Data," in the Microsoft Business Solutions CRM Data Migration Framework Guide.


ObjectTypeCode Values

The following table provides the Microsoft CRM ObjectTypeCode value and the CDF database EntityId value for each entity. Use this table as a reference when you are mapping your Activity, ActivityParty, Annotation, CustomerAddress, and drop-down list data.

Migrated entity | Microsoft CRM ObjectTypeCode value | CDF database EntityId value
Account | 1 | 1
Activity | 134 | 2
AppointmentActivity1 | 142 | 2
EmailActivity1 | 138 | 2
FaxActivity1 | 136 | 2
LetterActivity1 | 141 | 2
PhoneCallActivity1 | 137 | 2
TaskActivity1 | 134 | 2
ActivityParty | 135 | 39
Annotation | 5 | 3
BusinessUnit | 10 | 4
Competitor | 123 | 6
Contact | 2 | 7
CustomerAddress | 1071 | 8
Discount | 1013 | 9
DiscountType | 1080 | 10
Incident | 112 | 11
Invoice | 1090 | 14
InvoiceDetail | 1091 | 15
Lead | 4 | 16
Opportunity | 3 | 17
OpportunityProduct | 1083 | 38
Organization | 1019 | 18
PriceLevel | 1022 | 19
Product | 1024 | 21
ProductPriceLevel | 1026 | 22
Quote | 1084 | 23
QuoteDetail | 1085 | 24
SalesOrder | 1088 | 29
SalesOrderDetail | 1089 | 30
Subject | 129 | 31
SystemUser | 8 | 32
Territory | 2013 | 35
UoM | 1055 | 36
UoMSchedule | 1056 | 37

1 All types of activities are migrated from the cdf_Activity table.


StateCode and StatusCode Values

The following table shows the default Microsoft CRM values for StateCode and StatusCode. Each StateCode has its own default StatusCode value. For example, if an incident StateCode is 0 (Active), the default StatusCode is 1 (In Progress). If the incident StateCode is 1 (Resolved), the default StatusCode is 5 (Problem Solved). Microsoft CRM only accepts StatusCodes that are valid for a particular StateCode.

The CDF database stores only the integers that are shown in the table, not the text.

Entity | StateCode (Status) | Default Microsoft CRM StatusCode (Status Reason) | StatusCode customizable in Microsoft CRM?
Account | 0 Active (default) | 1 Active (default) | Yes
 | 1 Inactive | 2 Inactive (default) |
Activity | 0 Open | [Not used.] | No
 | 1 Completed | [Not used.] |
 | 2 Canceled | [Not used.] |
Contact | 0 Active (default) | 1 Active (default) | Yes
 | 1 Inactive | 2 Inactive (default) |
Discount | 0 Existing (set based on state of DiscountType) | [Not used.] | No
DiscountType | 0 Active (default) | [Not used.] | No
 | 1 Inactive | [Not used.] |
Incident | 0 Active (default) | 1 In Progress (default) | Yes
 |  | 2 On Hold |
 |  | 3 Waiting for Details |
 |  | 4 Researching |
 | 1 Resolved | 5 Problem Solved (default) |
 | 2 Canceled | 6 Canceled (default) |
Invoice | 0 Active | 1 New (default) |
 |  | 2 Partially Shipped |
 |  | 4 Billed |
 |  | 5 Booked (applies to services) |
 |  | 6 Installed (applies to services) |
 | 1 Closed | 3 Canceled (default) |
 |  | 7 Paid in Full |
Lead | 0 Open (default) | 1 New (default) | Yes
 |  | 2 Contacted |
 | 1 Qualified | 3 Qualified (default) |
 | 2 Disqualified | 4 Lost (default) |
 |  | 5 Cannot Contact |
 |  | 6 No Longer Interested |
 |  | 7 Canceled |
Opportunity | 0 Open (default) | 1 In Progress (default) | Yes
 |  | 2 On Hold |
 | 1 Won | 1 Won |
 | 2 Lost | 1 Canceled (default) |
 |  | 2 Out-Sold |
PriceLevel | 0 Active (default) | [Not used.] | No
 | 1 Inactive | [Not used.] |
Product | 0 Active (default) | 1 Active (default) | Yes
 | 1 Inactive | 2 Inactive (default) |
Quote | 0 Draft (default) | 1 In Progress (default) | Yes
 | 1 Active | 2 In Progress (default) |
 |  | 3 Open |
 | 2 Won | 4 Won (default) |
 | 3 Closed | 5 Lost (default) |
 |  | 6 Canceled |
 |  | 7 Revised |
SalesOrder | 0 Active (default) | 1 New (default) | Yes
 |  | 2 Pending |
 | 1 Submitted | 3 In Progress (default) |
 | 2 Canceled | 4 No Money (default) |


Industry Codes

The following values are the default values used for IndustryCodeName fields.

IndustryCodeName fields
Accounting | Inbound Capital Intensive Processing
Agriculture and Non-petrol Natural Resource Extraction | Inbound Repair and Services
Broadcasting Printing and Publishing | Insurance
Brokers | Legal Services
Building Supply Retail | Non-Durable Merchandise Retail
Business Services | Outbound Consumer Services
Consulting | Petrochemical Extraction and Distribution
Consumer Services | Service Retail
Design, Direction and Creative Management | SIG Affiliations
Distributors, Dispatchers and Processors | Social Services
Doctor's Offices and Clinics | Special Outbound Trade Contractors
Durable Manufacturing | Specialty Realty
Eating and Drinking Places | Transportation
Entertainment Retail | Utility Creation and Distribution
Equipment Rental and Leasing | Vehicle Retail
Financial | Wholesale
Food and Tobacco Processing |


How To

This section provides a number of samples illustrating how to use the APIs provided in this SDK. The following topics are covered:

  • Overview
  • Create a Business Unit Hierarchy
  • Create a Child Business Unit
  • Create a Team
  • Create a User
  • Create a Custom Role
  • Assign a Custom Role to a User
  • Assign a Predefined Role to a User
  • Create an Account and Related Contacts
  • Delete an Account and All Related Objects
  • Upload or Download an Attachment to a Note
  • Find All of the Incidents for an Account or Contact
  • Find the Teams for a User
  • Find All Privileges for a User
  • Create a Query 1
  • Create a Query 2
  • Create a Query 3


Overview

These samples show you how to perform a variety of tasks using the Microsoft Business Solutions CRM SDK.

Microsoft.Crm.Platform.Proxy Assembly

For access to the APIs as used in these code samples, you need to link to the following dynamic-link libraries (DLLs):

Microsoft.Crm.Platform.Proxy.dll

Microsoft.Crm.Platform.Types.dll

The proxy DLL contains the APIs and enumerations found in Microsoft.Crm.Platform.Proxy.

The types DLL contains the enumerations found in Microsoft.Crm.Platform.Types.

These DLLs can be found in the following path on the Microsoft CRM Server CD:

\wwwroot\bin\Microsoft.Crm.Platform.Proxy.dll

\wwwroot\bin\Microsoft.Crm.Platform.Types.dll

Related Topics

All these examples use the SOAP interface. For more information about using SOAP interfaces, refer to the MSDN SOAP Reference (msdn.microsoft.com/library/default.asp?url=/nhp/Default.asp?contentid=28000523).

For more information about Microsoft Windows® Active Directory®, refer to MSDN (www.microsoft.com/windows2000/technologies/directory/ad/default.asp). Also located on MSDN is the "Active Directory Programmers Guide" (msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/ad/active_directory.asp).


Create a Business Unit Hierarchy

This sample code creates the following business unit hierarchy:

Under the root business, Adventure Works, we create two child business units: Alpine Ski House and Blue Yonder Airlines. Under Blue Yonder Airlines we also create a child business: Markie's Travel. For each business we create two users.

The following diagram illustrates the organization hierarchy.

Business Unit Hierarchy

Class Reference

  • BizMerchant
  • BizOrganization
  • BizUser
  • CRMLicense

Schema Reference

  • businessunit.xsd
  • organization.xsd
  • systemuser.xsd

Example

Note The following sample contains sample data for the administrator login name and password. This is for illustration only. User credentials should never be hard-coded. For more information, see Building Secure ASP.NET Applications, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch12.asp.

[C#]

public void CreateBusinessHierarchy()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServer";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory = "mscrmservices";
   string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oBizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oBizUser.Url = strDir + "BizUser.srf";

   // BizMerchant proxy object
   Microsoft.Crm.Platform.Proxy.BizMerchant oMerchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
   oMerchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oMerchant.Url = strDir + "BizMerchant.srf";

   // BizOrganization proxy object
   Microsoft.Crm.Platform.Proxy.BizOrganization oOrganization = new Microsoft.Crm.Platform.Proxy.BizOrganization ();
   oOrganization.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oOrganization.Url = strDir + "BizOrganization.srf";

   // CrmLicense proxy object
   Microsoft.Crm.Platform.Proxy.CRMLicense oLicense = new Microsoft.Crm.Platform.Proxy.CRMLicense ();
   oLicense.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oLicense.Url = strDir + "CRMLicense.srf";

   string strErrorMsg;

   // See Note above regarding the use of hard-coded passwords
   string strDomainAdminName = "Administrator";
   string strDomainAdminPass = "Admin";
   string strDomainName = "MyDomain";

   try
   {
      Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = new Microsoft.Crm.Platform.Proxy.CUserAuth();   //oBizUser.WhoAmI();
      // License does a check for the Domain Admin, but we must provide a valid format GUID for the caller
      // In this case, the caller can have empty GUIDs
      Microsoft.Crm.Platform.Proxy.CUserAuth strDomainAdminCaller = new Microsoft.Crm.Platform.Proxy.CUserAuth();
      strDomainAdminCaller.MerchantId   = System.Guid.Empty.ToString("b");
      strDomainAdminCaller.UserId      = System.Guid.Empty.ToString("b");

      string strOrgName = "Contoso, Ltd";
      string strOrgID = "";

      // First create the organization OU in Active Directory, and then
      // get the object GUID as ID for the Microsoft CRM organization

      // CreateOrgOU is a DUMMY API
      // You need to write your own method to create the OU in Active Directory
      strOrgID = CreateOrgOU(strOrgName);

      // The XML string for the organization
      string strOrgXml = "<organization>" +
         "<name>" + strOrgName + "</name>" +
         "</organization>";

      // Set the object credentials to a user with domain administrator rights
      oOrganization.Credentials = new System.Net.NetworkCredential   (strDomainAdminName, strDomainAdminPass, strDomainName);
      oLicense.Credentials   = new System.Net.NetworkCredential(   strDomainAdminName, strDomainAdminPass, strDomainName);

      // Create the Microsoft CRM organization object
      oOrganization.Create(strOrgXml, strOrgID);

string strLicenseKey = "{QFL6W8JZ-TU8U-0NU6-1JKH-807F897C5027}";
// Microsoft CRM Suite Professional
string strLicenseType = "{59F6D48E-F7E8-46F3-806C-3CA992D21915}";

      // Grant the Professional Suite license to deployment
      oLicense.AddDeploymentLicense(strDomainAdminCaller, strOrgID, strLicenseType, strLicenseKey);

      // Set up the XML string for the root business
      // The name must be unique
      string strRootBizXML = "<businessunit>" +
         "<name>Adventure Works</name>" +
         "</businessunit>";

      // See Note above regarding the use of hard-coded passwords
      string strFirstUserName = "Keith_Harris";
      string strFirstUserPass = "Keith_Harris";

      string strUserXML = "<systemuser>" +
         "<firstname>Keith</firstname>" +
         "<lastname>Harris</lastname>" +
         "<domainname>" + strFirstUserName + "</domainname>" +
         "</systemuser>";

      // Create a root business
      Microsoft.Crm.Platform.Proxy.CBusinessResult BizResult = new Microsoft.Crm.Platform.Proxy.CBusinessResult ();
      BizResult = oOrganization.CreateRootBusiness(strOrgID, strRootBizXML, strUserXML);

      // Grant the Professional Suite license to the first user
      oLicense.GrantUserLicense(strDomainAdminCaller, oUserAuth.UserId, "{59f6d48e-f7e8-46f3-806c-3ca992d21915}");

      // Set the user authorization for the first user
      oUserAuth.UserId = BizResult.UserId;
      oUserAuth.MerchantId = BizResult.BusinessId;

      // Set credentials for these objects for first user
      oMerchant.Credentials = new System.Net.NetworkCredential(   strFirstUserName, strFirstUserPass, strDomainName );
      oBizUser.Credentials = new System.Net.NetworkCredential(   strFirstUserName, strFirstUserPass, strDomainName );
      oLicense.Credentials = new System.Net.NetworkCredential(   strFirstUserName, strFirstUserPass, strDomainName );

      // Create a business unit
      string strSubBusiness1 = "<businessunit>";
      strSubBusiness1 += "<parentbusinessunitid>" + oUserAuth.MerchantId + "</parentbusinessunitid>";
      strSubBusiness1 += "<name>Alpine Ski House</name>";
      strSubBusiness1 += "</businessunit>";

      // When the last parameter is provided as empty, no user will
      // be created while creating a business unit
      Microsoft.Crm.Platform.Proxy.CBusinessResult oResult = oMerchant.Create(oUserAuth, strSubBusiness1, "");
      string strBusiness1_Id = oResult.BusinessId;
      string strUserName = null;

      // Create a user
      strUserName = "Nicole_Caron";
      string strUserA_1 = "<systemuser><firstname>Nicole</firstname>";
      strUserA_1 += "<lastname>Caron</lastname>";
      strUserA_1 += "<domainname>" + strUserName + "</domainname>";
      strUserA_1 += "<businessunitid>" + strBusiness1_Id;
      strUserA_1 += "</businessunitid></systemuser>";

      // The BizUser.Create method will fail if the user has not
      // already been added to Active Directory
      string strUserA_1Id = oBizUser.Create(oUserAuth, strUserA_1);

      // Grant Professional Suite license to the user
      oLicense.GrantUserLicense(oUserAuth, strUserA_1Id, "{59f6d48e-f7e8-46f3-806c-3ca992d21915}");

      // Create another user
      strUserName = "Ajay_Solanki";
      string strUserA_2 = "<systemuser><firstname>Ajay</firstname>";
      strUserA_2 += "<lastname>Solanki</lastname>";
      strUserA_2 += "<domainname>" + strUserName + "</domainname>";
      strUserA_2 += "<businessunitid>" + strBusiness1_Id;
      strUserA_2 += "</businessunitid></systemuser>";

      // The BizUser.Create method will fail if the user has not
      // already been added to Active Directory
      string strUserA_2Id = oBizUser.Create(oUserAuth, strUserA_2);

      // Grant Professional Suite license to the user
      oLicense.GrantUserLicense(oUserAuth, strUserA_1Id, "{59f6d48e-f7e8-46f3-806c-3ca992d21915}");

      // Create another business unit
      string strSubBusiness2 = "<businessunit>";
      strSubBusiness2 += "<parentbusinessunitid>";
      strSubBusiness2 += oUserAuth.MerchantId;
      strSubBusiness2 += "</parentbusinessunitid>";
      strSubBusiness2 += "<name>Blue Yonder Airlines</name>";
      strSubBusiness2 += "</businessunit>";

      // When the last parameter is provided as empty, no user will
      // be created while creating a business unit
      oResult= oMerchant.Create(oUserAuth, strSubBusiness2, "");
      string strBusinessB_Id = oResult.BusinessId;

      // Create a user
      strUserName = "Debra_E_Keiser";
      string strUserB_1 = "<systemuser><firstname>Debra</firstname>";
      strUserB_1 += "<lastname>Keiser</lastname>";
      strUserB_1 += "<domainname>" + strUserName + "</domainname>";
      strUserB_1 += "<businessunitid>" + strBusinessB_Id;
      strUserB_1 += "</businessunitid></systemuser>";

      // The BizUser.Create method will fail if the user has not
      // already been added to Active Directory
      string strUserB_1Id = oBizUser.Create(oUserAuth, strUserB_1);

      // Grant Professional Suite license to the user
      oLicense.GrantUserLicense(oUserAuth, strUserA_1Id, "{59f6d48e-f7e8-46f3-806c-3ca992d21915}");

      // Create another user
      strUserName = "Imtiaz_Khan";
      string strUserB_2 = "<systemuser><firstname>Imtiaz</firstname>";
      strUserB_2 += "<lastname>Khan</lastname>";
      strUserB_2 += "<domainname>" + strUserName + "</domainname>";
      strUserB_2 += "<businessunitid>" + strBusinessB_Id;
      strUserB_2 += "</businessunitid></systemuser>";

      // The BizUser.Create method will fail if the user has not
      // already been added to Active Directory
      string strUserB_2Id = oBizUser.Create(oUserAuth, strUserB_2);

      // Create a child business of business B
      string strSubBusinessB1 = "<businessunit><parentbusinessunitid>";
      strSubBusinessB1 += strBusinessB_Id;
      strSubBusinessB1 += "</parentbusinessunitid>";
      strSubBusinessB1 += "<name>Margie's Travel</name>";
      strSubBusinessB1 += "</businessunit>";

      // When the last parameter is provided as empty, no user will
      // be created while creating a business unit
      oResult= oMerchant.Create(oUserAuth, strSubBusinessB1, "");
      string strBusinessB1_Id = oResult.BusinessId;

      // Create a user
      strUserName = "Min_Su";
      string strUserB1_1 = "<systemuser><firstname>Min</firstname>";
      strUserB1_1 += "<lastname>Su</lastname>";
      strUserB1_1 += "<domainname>" + strUserName + "</domainname>";
      strUserB1_1 += "<businessunitid>" + strBusinessB1_Id;
      strUserB1_1 += "</businessunitid></systemuser>";

      // The BizUser.Create method will fail if the user has not
      // already been added to Active Directory
      string strUserB1_1Id = oBizUser.Create(oUserAuth, strUserB1_1);

      // Grant Professional Suite license to the user
      oLicense.GrantUserLicense(oUserAuth, strUserA_1Id, "{59f6d48e-f7e8-46f3-806c-3ca992d21915}");

      // Create another user
      strUserName = "Yale_Li";
      string strUserB1_2 = "<systemuser><firstname>Yale</firstname>";
      strUserB1_2 += "<lastname>Li</lastname>";
      strUserB1_2 += "<domainname>" + strUserName + "</domainname>";
      strUserB1_2 += "<businessunitid>" + strBusinessB1_Id;
      strUserB1_2 += "</businessunitid></systemuser>";

      // The BizUser.Create method will fail if the user has not
      // already been added to Active Directory
      string strUserB1_2Id = oBizUser.Create(oUserAuth, strUserB1_2);

      // Grant Professional Suite license to the user
      oLicense.GrantUserLicense(oUserAuth, strUserB1_2Id, "{59f6d48e-f7e8-46f3-806c-3ca992d21915}");

   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
   finally
   {
      // Set back the credentials to default
      oOrganization.Credentials = System.Net.CredentialCache.DefaultCredentials;
      oMerchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
      oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
      oLicense.Credentials = System.Net.CredentialCache.DefaultCredentials;
   }
}


Create a Child Business Unit

This sample creates a child business unit with one new user.

Class Reference

  • BizMerchant
  • BizUser

Schema Reference

  • businessunit.xsd
  • systemuser.xsd

Example

[C#]

// The precondition for this code to work is that there needs to be
// an organization, a business unit within the organization, and a user within
// the business unit whose 'domainname' corresponds to the Active Directory
// name of the currently logged on user

public void CreateSubBusiness()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory = "mscrmservices";
   string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oBizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oBizUser.Url = strDir + "BizUser.srf";

   // BizMerchant proxy object
   Microsoft.Crm.Platform.Proxy.BizMerchant oMerchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
   oMerchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oMerchant.Url = strDir + "BizMerchant.srf";

   string strErrorMsg;
   try
   {
      Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = oBizUser.WhoAmI();

      // Microsoft CRM business hierarchy directly maps to the Organizational
      // hierarchy in Active Directory. One constraint is that no
      // two child business units under the same location can have the same name

      // For this sample code to succeed, there should not be a
      // child business units named SubBusiness2 already under the same place
      string strSubBusiness = "<businessunit>";
      strSubBusiness += "<parentbusinessunitid>";
      strSubBusiness += oUserAuth.MerchantId;
      strSubBusiness += "</parentbusinessunitid>";
      strSubBusiness += "<name>" + "SubBusiness2" + "</name>";
      strSubBusiness+= "</businessunit>";

      string strUserName = "Frank_Lee";

      // The 'domainname' field must map to an existing Active Directory
      // user's name. At the same time, if that name is already used to
      // create a user, it cannot be reused
      string strUserXml = "<systemuser><domainname>" + strUserName;
      strUserXml += "</domainname></systemuser>";

      Microsoft.Crm.Platform.Proxy.CBusinessResult oResult = oMerchant.Create(oUserAuth, strSubBusiness, strUserXml);
      string strSubBusinessId = oResult.BusinessId;
      string strUserId = oResult.UserId;

   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Create a Team

This sample creates a team with one member.

Class Reference

  • BizTeam
  • BizUser

Schema Reference

  • team.xsd

Example

[C#]

// The precondition for this code to work is that there needs to be
// an organization, a business unit within the organization, and a user within
// the business unit whose 'domainname' corresponds to the Active Directory
// name of the currently logged on user

public void CreateTeam()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory = "mscrmservices";
   string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oBizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oBizUser.Url = strDir + "BizUser.srf";

   // BizTeam proxy object
   Microsoft.Crm.Platform.Proxy.BizTeam oTeam = new Microsoft.Crm.Platform.Proxy.BizTeam ();
   oTeam.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oTeam.Url = strDir + "BizTeam.srf";

   string strErrorMsg;
   try
   {
      Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = oBizUser.WhoAmI();

      // Microsoft CRM business hierarchy directly maps to the Organizational
      // hierarchy in Active Directory. One constraint is that no
      // two child business units under the same location can have the same name.

      // In this context, a team also corresponds to an Active Directory
      // organization unit under the business unit in which it is created
      // and cannot have the same name as other items under the same place
      // (other teams, other child business units)

      string strTeam = "<team>";
      strTeam += "<name>MyTeam</name>";
      strTeam += "<businessunitid>" + oUserAuth.MerchantId;
      strTeam += "</businessunitid>";
      strTeam += "</team>";

      string [] Members = new string[1];
      Members[0] = oUserAuth.UserId;

      // Create the team
      string strTeamId = oTeam.Create(oUserAuth, strTeam, Members);
   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Create a User

In order to create a user, the user name must have already been added to Windows Active Directory. This can either be done by hand or programmatically.

For more information about Active Directory, see the documentation on MSDN (www.microsoft.com/windows2000/technologies/directory/ad/default.asp).

For more information about the Active Directory SDK, see the documentation on MSDN (msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/ad/active_directory.asp).

Class Reference

  • BizUser

Schema Reference

  • systemuser.xsd

Example

[C#]

// The precondition for this code to work is that there needs to be
// an organization, a business unit within the organization, and a user within
// the business unit whose domainname corresponds to the Active Directory
// name of the currently logged on user

public void CreateUser()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory = "mscrmservices";
   string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oBizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oBizUser.Url = strDir + "BizUser.srf";

   string strErrorMsg;
   string strUserName;
   try
   {
      Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = oBizUser.WhoAmI();

      // The 'domainname' field must map to an existing Active Directory
      // user's name. At the same time, if that name is already used to
      // create a user, it cannot be reused

      strUserName = "Reed_Koch";

      // For this sample code to succeed, 'Reed_Koch' must be a valid user in
      // the domain where the code is run, and none of the existing
      // Microsoft CRM users already map to it
      string strUser = "<systemuser><firstname>Reed</firstname>";
      strUser += "<lastname>Koch</lastname>";
      strUser+= "<domainname>" + strUserName + "</domainname>";
      strUser+= "<businessunitid>" + oUserAuth.MerchantId;
      strUser+= "</businessunitid>" + "</systemuser>";

      // Create the user
      string strUserId = oBizUser.Create(oUserAuth, strUser);
   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Create a Custom Role

This sample creates a custom security role called Security Analyst.

Class Reference

  • SecRole
  • BizUser

Schema Reference

  • role.xsd

Example

[C#]

public void CreateCustomRole()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory   = "mscrmservices";

   // Create the URL to the SRF files for platform objects
   string strDir = "http://" + strServer + "/";
   strDir += strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oUser = new Microsoft.Crm.Platform.Proxy.BizUser();
   oUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oUser.Url = strDir + "BizUser.srf";

   // SecRole proxy object
   Microsoft.Crm.Platform.Proxy.SecRole oSecRole = new Microsoft.Crm.Platform.Proxy.SecRole();
   oSecRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oSecRole.Url = strDir + "SecRole.srf";

   // Declare the caller
   Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = null;

   string strSecRoleXML = "";
   string strRoleId = "";
   string strErrorMsg = "";

   try
   {
      // Get the UserAuth of the currently logged on user
      oUserAuth = oUser.WhoAmI();

      // Build a role XML string in the business unit of the caller
      strSecRoleXML = "<role>" + "<name>Security Analyst</name>";
      strSecRoleXML + = "<businessunitid>" + oUserAuth.MerchantId
      strSecRoleXML += "</businessunitid>" + "</role>";

      // Create a custom role
      // Create returns the ID of the new role
      strRoleId = oSecRole.Create(oUserAuth, strSecRoleXML);

      string strPrivId = null;
      string [] sPrivIds = new string [2];

   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Assign a Custom Role to a User

This sample assigns a custom security role to a user.

Class Reference

  • SecRole
  • BizUser

Schema Reference

  • role.xsd

Example

[C#]

public void AssignCustomRole()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory   = "mscrmservices";

   // Create the URL to the SRF files for platform objects
   string strDir = "http://" + strServer + "/" +  strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oUser.Url = strDir + "BizUser.srf";

   // SecRole proxy object
   Microsoft.Crm.Platform.Proxy.SecRole oSecRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
   oSecRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oSecRole.Url = strDir + "SecRole.srf";

   // Declare the caller
   Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = null;

   string strSecRoleXML = "";
   string strErrorMsg = "";

   // Array for role IDs and for privilege IDs
   string [] strRoleIds = new string[1];
   Microsoft.Crm.Platform.Proxy.CRolePrivilege [] strPrivilegeIds = new Microsoft.Crm.Platform.Proxy.CRolePrivilege[2];

   try
   {
      // Get the UserAuth of the currently logged on user
      oUserAuth = oUser.WhoAmI();

      // Build a role XML string in the business unit of the caller
      // Name of the role should be unique in an organization
      strSecRoleXML = "<role>" +
         "<name>Sales Assistant</name>" +
         "<businessunitid>" + oUserAuth.MerchantId + "</businessunitid>" +
         "</role>";

      // Create a custom role
      strRoleIds[0] = oSecRole.Create(oUserAuth, strSecRoleXML);

      // Get a couple of privileges to be added to this role
      strPrivilegeIds[0] = new Microsoft.Crm.Platform.Proxy.CRolePrivilege();
      strPrivilegeIds[1] = new Microsoft.Crm.Platform.Proxy.CRolePrivilege();

      // Users can create accounts (BASIC)
      strPrivilegeIds[0].PrivilegeId = "{D26FE964-230B-42DD-AD93-5CC879DE411E}";
      strPrivilegeIds[0].Depth = Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH.BASIC;

      // Users can read accounts (BASIC)
      strPrivilegeIds[1].PrivilegeId = "{886B280C-6396-4D56-A0A3-2C1B0A50CEB0}";
      strPrivilegeIds[1].Depth = Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH.BASIC;

      // Add a couple of privileges to the role
      oSecRole.AddPrivileges(oUserAuth, strRoleIds[0], strPrivilegeIds);

      // Assign the custom role to the caller user
      oSecRole.AssignUserRoles(oUserAuth, oUserAuth.UserId, strRoleIds);
   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Assign a Predefined Role to a User

This sample assigns a predefined security role to a user.

Class Reference

  • SecRole
  • BizUser

Example

[C#]

public void AssignPredefinedRole()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory   = "mscrmservices";

   // Create the URL to the SRF files for platform objects
   string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oUser.Url = strDir + "BizUser.srf";

   // SecRole proxy object
   Microsoft.Crm.Platform.Proxy.SecRole oSecRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
   oSecRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oSecRole.Url = strDir + "SecRole.srf";

   // Declare the caller
   Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = null;

   // Array for role IDs
   string [] strRoleIds = new string[1];

   // Sales Manager role name
   string strRoleName = "Sales Manager";
   string strErrorMsg = "";

   try
   {
      // Get the UserAuth of the currently logged on user
      oUserAuth = oUser.WhoAmI();

      // Get the ID of the Sales Manager role in the caller's business
      strRoleIds[0] = oSecRole.RetrieveIdFromName(oUserAuth, oUserAuth.MerchantId, strRoleName);

      // Assign the Sales Manager role to the caller user
      oSecRole.AssignUserRoles(oUserAuth, oUserAuth.UserId, strRoleIds);
   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Create an Account and Related Contacts

This sample creates an account and some related contacts.

Class Reference

  • CRMAccount
  • CRMContact
  • BizUser

Schema Reference

  • account.xsd
  • contact.xsd

Example

[C#]

public void CreateAccountAndRelatedContacts()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory = "mscrmservices";
   string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oBizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oBizUser.Url = strDir + "BizUser.srf";

   // Account proxy object
   Microsoft.Crm.Platform.Proxy.CRMAccount oAccount = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
   oAccount.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oAccount.Url = strDir + "CRMAccount.srf";

   // Contact proxy object
   Microsoft.Crm.Platform.Proxy.CRMContact oContact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
   oContact.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oContact.Url = strDir + "CRMContact.srf";
   string strErrorMsg;
   try
   {
      Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = oBizUser.WhoAmI();

      string strAccount = "<account><name>Account One</name>";
      strAccount += "<ownerid type=\"";
      strAccount += Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString();
      strAccount += "\">" + oUserAuth.UserId;
      strAccount += "</ownerid></account>";

      string strContact = "<contact><firstname>Dave/firstname>";
      strContact += "<lastname>Natsuhara</lastname>";
      strContact += "<telephone2>206-555-0100</telephone2>";
      strContact += "<emailaddress1>dave@northwindtraders.com</emailaddress1>";
      strContact += "<ownerid type=\"";
      strContact += Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
      strContact += oUserAuth.UserId + "</ownerid></contact>";

      string strAccountId = oAccount.Create(oUserAuth, strAccount);
      string strContactId = oContact.Create(oUserAuth, strContact);

      // There are two relationships between Accounts and Contacts:
      // Hierarchical and Primary Contact

      // Create a hierarchy where the Account is the parent
      // of the Contact
      oAccount.AddSubContact(oUserAuth, strAccountId, strContactId);

      // Make the Contact a primary contact of the Account
      oAccount.SetPrimaryContact(oUserAuth, strAccountId, strContactId);
   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Delete an Account and All Related Objects

This sample shows how to delete an account and all of its related objects.

Class Reference

  • CRMAccount
  • CRMContact
  • BizUser

Schema Reference

  • account.xsd
  • contact.xsd

Example

[C#]

public void DeleteAccountAndRelatedObjects()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory = "mscrmservices";
   string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oBizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oBizUser.Url = strDir + "BizUser.srf";

   // Account proxy object
   Microsoft.Crm.Platform.Proxy.CRMAccount oAccount = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
   oAccount.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oAccount.Url = strDir + "CRMAccount.srf";

   // Contact proxy object
   Microsoft.Crm.Platform.Proxy.CRMContact oContact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
   oContact.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oContact.Url = strDir + "CRMContact.srf";

   string strErrorMsg;
   try
   {
      Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = oBizUser.WhoAmI();

      // Create a dummy account and contact that you can then delete
      string strAccount = "<account><name>North Wind Traders</name><ownerid type=\""
         + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">"
         + oUserAuth.UserId + "</ownerid></account>";

      string strContact = "<contact><firstname>Angela</firstname>";
      strContact += "<telephone2>206-555-0102</telephone2>";
      strContact += "<lastname>Barbariol</lastname>";
      strContact += "<emailaddress1>angela@northwindtraders.com</emailaddress1>";
      strContact += "<ownerid type=\"";
      strContact += Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
      strContact += oUserAuth.UserId + "</ownerid></contact>";

      // Create the account and contact
      string strAccountId = oAccount.Create(oUserAuth, strAccount);
      string strContactId = oContact.Create(oUserAuth, strContact);

      //Create a hierarchy where the Account is the parent of the Contact
      oAccount.AddSubContact(oUserAuth, strAccountId, strContactId);

      // This call will delete both the Account and its contact
      // It will also delete all other objects attached to the account
      oAccount.Delete(oUserAuth, strAccountId);
   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Upload or Download an Attachment to a Note

To upload or download an attachment you must use an HTML page. This HTML page must exist on a server in the same domain as the Microsoft CRM server. You can use this method with a note, an activity attachment, and a sales literature item. This example is for the note class. See Results below.

Class Reference

  • CRMNotesManager
  • CRMActivityAttachment
  • CRMSalesLiteratureItem

Schema Reference

  • annotation.xsd

Example

[C#]

// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
try
{
   userAuth = bizUser.WhoAmI();

   // Set up the XML string for NotesManager
   string strNotesManagerXml = "<annotation>";
   strNotesManagerXml += "<subject>Sample Note</subject>";
   strNotesManagerXml += "<isdocument>0</isdocument>";
   strNotesManagerXml += "<notetext>Here is the note text</notetext>";
   strNotesManagerXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strNotesManagerXml += userAuth.UserId + "</ownerid>";
   strNotesManagerXml += "</annotation>";

   // Now create the note
   string strNoteId = notesmanager.Create(userAuth,strNotesManagerXml);

   // This is the ID of a contact that already exists
   string strContactId = "{E7B5C6F8-9A0B-4049-897B-E5852673D98E}";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strContactId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otContact;

   // Attach the note to a contact
   notesmanager.SetParent(userAuth, strNoteId, objName);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}
[HTML]
NoteUpload.htm
<html>
   <head>
      <title>Note Upload</title></head>
   <body alink="#0000ff" vlink="#0000ff" bgcolor="#ffffff">
      <form name="Attachments" enctype="multipart/form-data" method="POST" action="http://myservername/MSCRMSERVICES/NoteUpload.srf">
         <input type="hidden" name="AttachmentType" value="5"> <input type="hidden" name="AttachmentId" value="{192D46FF-1F84-4F74-AE74-BABC3E4AC70B}">
         <input type="hidden" name="UserId" value="{78861AAC-6104-4283-B303-0C861108FE26}">
         <input type="hidden" name="MerchantId" value="{C59799EE-412C-4096-B60C-FA1AD13AA4CB}">
         <input type="hidden" name="ErrorURL" value="http://myservername/AttachmentHelpers/error.htm">
         <input type="hidden" name="SuccessURL" value="http://myservername/AttachmentHelpers/NoteDownload.htm">
         <input type="File" name="userFile" size="20"> <input type="submit" name="UPL" value="Submit">
   </body>
</html>

NoteDownload.htm
<html>
   <head>
      <title>Note Download</title></head>
   <body alink="#0000ff" vlink="#0000ff" bgcolor="#ffffff">
      <A HREF="http://myservername/MSCRMSERVICES/NoteDownload.srf?AttachmentType=5&AttachmentId=%7B192D46FF-1F84-4F74-AE74-BABC3E4AC70B%7D&UserId=%7B78861AAC-6104-4283-B303-0C861108FE26%7D&MerchantId=%7BC59799EE-412C-4096-B60C-FA1AD13AA4CB%7D&ErrorURL=http://myservername/AttachmentHelpers/error.htm&FileName=NoteFile.txt">
         Download!</A>
   </body>
</html>

Results

When you click the Submit button in the form, the HTML page will try to upload the file. If there is an error, it will go to the URL specified in the tag named ErrorUrl. A query string will be added to the end of this file such as:

http://<servername>/AttachmentHelpers/error.htm&hr=80040217

If there is no error, the HTML page will go to the URL specified in the tag named SuccessURL.


Find All of the Incidents for an Account or Contact

This sample retrieves all the incidents (cases) associated with an account or contact.

Class Reference

  • CRMAccount
  • CRMContact
  • CRMIncident
  • BizUser

Schema Reference

  • account.xsd
  • contact.xsd
  • incident.xsd

Example

[C#]

public void RetrieveAssociatedCases()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server

   string strVirtualDirectory = "mscrmservices";
   string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";
   string sResult = "";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oBizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oBizUser.Url = strDir + "BizUser.srf";

   // Account proxy object
   Microsoft.Crm.Platform.Proxy.CRMAccount oAccount = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
   oAccount.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oAccount.Url = strDir + "CRMAccount.srf";

   // Contact proxy object
   Microsoft.Crm.Platform.Proxy.CRMContact oContact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
   oContact.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oContact.Url = strDir + "CRMContact.srf";

   // Incident proxy object
   Microsoft.Crm.Platform.Proxy.CRMIncident oIncident = new Microsoft.Crm.Platform.Proxy.CRMIncident ();
   oIncident.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oIncident.Url = strDir + "CRMIncident.srf";

   string strErrorMsg;
   try
   {
      Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = oBizUser.WhoAmI();

      string strAccount = "<account><name>North Wind Traders</name><ownerid type=\""
         + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">"
         + oUserAuth.UserId + "</ownerid></account>";

      string strContact = "<contact><firstname>Rachel</firstname>";
      strContact += "<telephone2>206-555-0103</telephone2><lastname>Valdez</lastname>";
      strContact += "<emailaddress1>rachel@northwindtraders.com</emailaddress1><ownerid type=\"";
      strContact += Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
      strContact += oUserAuth.UserId + "</ownerid></contact>";

      string strAccountId = oAccount.Create(oUserAuth,strAccount);
      string strContactId = oContact.Create(oUserAuth,strContact);

      // Create an incident associated with the Account
      string strIncident = "<incident><title>Incident A</title>";
      strIncident += "<accountid>"+ strAccountId +"</accountid><ownerid type=\"";
      strIncident += Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
      strIncident += oUserAuth.UserId + "</ownerid></incident>";

      string strIncidentId = oIncident.Create(oUserAuth, strIncident);

      Microsoft.Crm.Platform.Proxy.CObjectName oObj = new Microsoft.Crm.Platform.Proxy.CObjectName();
      oObj.Id = strAccountId;
      oObj.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

      // Retrieve Cases associated with the Account
      sResult = oIncident.RetrieveByObject(oUserAuth, oObj, "<columnset><column>title</column></columnset>");

      // Create an incident associated with the Contact
      string strIncident2 = "<incident><title>Incident B</title>";
      strIncident2 += "<contactid>"+ strContactId + "</contactid><ownerid type=\"";
      strIncident2 += Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
      strIncident2 += oUserAuth.UserId + "</ownerid></incident>";

      strIncidentId = oIncident.Create(oUserAuth, strIncident2);

      oObj = new Microsoft.Crm.Platform.Proxy.CObjectName();
      oObj.Id = strContactId;
      oObj.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otContact;

      // Retrieve Cases associated with the Account
      sResult = oIncident.RetrieveByObject(oUserAuth, oObj, "<columnset><column>title</column></columnset>");
   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Find the Teams for a User

This sample retrieves a list of teams to which the user belongs.

Class Reference

  • BizUser

Schema Reference

  • team.xsd

Example

[C#]

// The precondition for this code to work is that there needs to be
// an organization, a business unit within the organization, and a user within
// the business unit whose 'domainname' corresponds to the Active Directory
// name of the currently logged on user

public void RetrieveTeamsOfUser()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory = "mscrmservices";
   string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oBizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oBizUser.Url = strDir + "BizUser.srf";

   string strErrorMsg;
   try
   {
      Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = oBizUser.WhoAmI();

      // ColumnSetXML specifies which columns to retrieve from the team
      // object. It can also specify filtering conditions, but it is out
      // of the scope for this sample

      // For simple usage, setting ColumnSetXML to empty string will
      // return all columns
      string ColumnSetXML = "<columnset><column>teamid</column></columnset>";

      string strTeamsXML = oBizUser.RetrieveTeams(oUserAuth, oUserAuth.UserId, ColumnSetXML);
   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Find All Privileges for a User

This sample finds all the privileges a user holds through his or her roles.

Class Reference

  • SecRole
  • BizUser

Example

[C#]

public void GetUserPrivileges()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory   = "mscrmservices";

   // Create the URL to the SRF files for platform objects
   string strDir = "http://" + strServer + "/";
   strDir += strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oUser.Url = strDir + "BizUser.srf";

   // SecRole proxy object
   Microsoft.Crm.Platform.Proxy.BizPrivilege oPrivilege = new Microsoft.Crm.Platform.Proxy.BizPrivilege ();
   oPrivilege.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oPrivilege.Url = strDir + "BizPrivilege.srf";

   // Declare the caller
   Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = null;

   string strErrorMsg = "";
   Microsoft.Crm.Platform.Proxy.CRolePrivilege [] rolePrivResult = null;
   try
   {
      // Get the UserAuth of the currently logged on user
      oUserAuth = oUser.WhoAmI();

      // Retrieve all privileges of the caller user from the business
      // to which he or she belongs
      rolePrivResult = oPrivilege.RetrieveUserPrivileges(oUserAuth, oUserAuth.UserId);
   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Creating a Query 1

This sample creates a query that will find all the accounts for which the user has read access.

Class Reference

  • CRMQuery
  • BizUser

Schema Reference

  • account.xsd
  • savedquery.xsd
  • Fetch XML Schema

Example

[C#]

public void CreateQuery()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory = "mscrmservices";
   string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oBizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oBizUser.Url = strDir + "BizUser.srf";

   // Query proxy object
   Microsoft.Crm.Platform.Proxy.CRMQuery oQuery = new Microsoft.Crm.Platform.Proxy.CRMQuery ();
   oQuery.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oQuery.Url = strDir + "CRMQuery.srf";

   string strErrorMsg;
   try
   {
      Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = oBizUser.WhoAmI();

      // This is "select * from Account" and will return all
      // accounts for which you have read access
      string strFetchXml = "<fetch mapping='logical'><entity name='account'>";
      strFetchXml += "<all-attributes/></entity></fetch>";

      // This is to get the ID of the organization
      string strRetrieveUser = oBizUser.Retrieve(oUserAuth, oUserAuth.UserId, "");
      System.Xml.XmlDocument oDoc = new System.Xml.XmlDocument();
      oDoc.LoadXml(strRetrieveUser);
      string strOrganizationId = oDoc.GetElementsByTagName("organizationid").Item(0).InnerText;

      // This is the XML data used for creating a query
      string strQueryXml = "<savedquery>";
      strQueryXml += "<name>my query</name>";
      strQueryXml += "<returnedtypecode>0</returnedtypecode>";
      strQueryXml += "<iscustomizable>0</iscustomizable>";
      strQueryXml += "<isdefault>0</isdefault>";
      strQueryXml += "<isquickfindquery>0</isquickfindquery>";
      strQueryXml += "<querytype>0</querytype>";
      strQueryXml += "<fetchxml>" + strFetchXml + "</fetchxml>";
      strQueryXml += "</savedquery>";

      // Create the query
      string strQueryId = oQuery.Create(oUserAuth, Microsoft.Crm.Platform.Proxy.ObjectType.otAccount, strQueryXml);
   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Creating a Query 2

This sample does not create a query but simply executes a query to find all the accounts for which the user has read access.

Class Reference

  • CRMQuery
  • BizUser

Schema Reference

  • account.xsd
  • Fetch XML Schema

Example

[C#]

public void SimpleQuery()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory = "mscrmservices";
   string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oBizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oBizUser.Url = strDir + "BizUser.srf";

   // Query proxy object
   Microsoft.Crm.Platform.Proxy.CRMQuery oQuery = new Microsoft.Crm.Platform.Proxy.CRMQuery ();
   oQuery.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oQuery.Url = strDir + "CRMQuery.srf";

   string strErrorMsg;
   string strAccounts;
   try
   {
      Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = oBizUser.WhoAmI();

      // This is "select * from Account" and will return
      // all accounts for which you have read access
      string strQuery = "<fetch mapping='logical'><entity name='account'>";
      strQuery += "<all-attributes /></entity></fetch>";

      // This should return a resultset with all the accounts you can see
      strAccounts = oQuery.ExecuteQuery(oUserAuth, strQuery);
   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Creating a Query 3

This sample creates a more complex query against the account object.

Class Reference

  • CRMQuery
  • BizUser

Schema Reference

  • account.xsd
  • savedquery.xsd
  • Fetch XML Schema

Example

[C#]

public void IntermediateQuery()
{
   // strServer should be set with the name of the platform Web server
   string strServer = "MyServerName";

   // strVirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string strVirtualDirectory = "mscrmservices";
   string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser oBizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oBizUser.Url = strDir + "BizUser.srf";

   // Query proxy object
   Microsoft.Crm.Platform.Proxy.CRMQuery oQuery = new Microsoft.Crm.Platform.Proxy.CRMQuery ();
   oQuery.Credentials = System.Net.CredentialCache.DefaultCredentials;
   oQuery.Url = strDir + "CRMQuery.srf";

   string strErrorMsg;
   string strAccounts;
   try
   {
      Microsoft.Crm.Platform.Proxy.CUserAuth oUserAuth = oBizUser.WhoAmI();

      // This query is "select accountid and name from Accounts where
      // the owner's last name is not 'Cannon' and it is not null"
      // and will return all accounts for which you have read access
      string strQuery = "<fetch mapping='logical'><entity name='account'>";
      strQuery += "<attribute name = 'accountid'/>";
      strQuery += "<attribute name = 'name'/>";
      strQuery += "<link-entity name='systemuser' to='ownerid'>";
      strQuery += "<filter type='and'>";
      strQuery += "<condition attribute = 'lastname' ";
      strQuery += "operator='ne' value=Cannon/>";
      strQuery += "<condition attribute = 'lastname' ";
      strQuery += "operator='not-null'/>";
      strQuery += "</filter>";
      strQuery += "</link-entity>";
      strQuery += "</entity></fetch>";

      // This will return a resultset with all the accounts you can see
      strAccounts = oQuery.ExecuteQuery(oUserAuth,strQuery);
   }
   catch(System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch(Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
   }
}


Reference

This section contains reference documentation of the public classes that constitute the Microsoft Business Solutions CRM platform.

This section contains the following information:

Class Library

Supplies syntax, code examples, and related information for each class contained in the Microsoft CRM SDK.

Microsoft.Crm.Platform.Proxy

Contains the classes and enumerations that are used to access the Microsoft CRM platform.

Microsoft.Crm.Platform.Types

Contains the classes used within the XML strings that are used by the Microsoft CRM platform.

Schemas

Documents the Microsoft CRM metabase schema, the Fetch XML schema, and the ColumnSet schema.

Workflow Reference

Provides detailed information about how to build custom workflows.

Object Types

Provides a mapping of object type codes.

Error Codes

Provides a complete listing of error return codes.

SOAP Interfaces

Lists the SOAP APIs.

Document Conventions

For information about the document conventions this reference section uses, see Document Conventions.


Class Library

This class library is a library of classes, interfaces, and enumerations that are included in the Microsoft CRM SDK. These are found in the Microsoft.Crm.Platform.Proxy.dll assembly. This library provides access to system functionality and is designed to be the foundation on which custom Microsoft CRM applications are built.

The Microsoft.Crm.Platform.Types.dll assembly contains the value types used to build XML strings for the APIs found in the proxy assembly.

Note Version 1.0 used the Microsoft.CRM.Proxy.dll assembly. This DLL is no longer provided with version 1.2. Microsoft.Crm.Platform.Proxy.dll is used instead.

Namespaces

The Microsoft CRM class library provides the following namespaces:

Microsoft.Crm.Platform.Proxy

Contains the classes and enumerations that are used to access the Microsoft CRM platform.

Microsoft.Crm.Platform.Types

Contains the enumerations used within the XML strings that are used by the Microsoft CRM platform.

Microsoft.CRM.Proxy

This namespace is deprecated. Use Microsoft.Crm.Platform.Proxy instead.

Microsoft.CRM.Flags

This namespace is deprecated. Use Microsoft.Crm.Platform.Types instead.


Microsoft.Crm.Platform.Proxy

This namespace contains the collection of classes and enumerations that are the foundation for building vertical applications with Microsoft CRM.

This namespace contains classes and enumerations as follows:

  • Microsoft.Crm.Platform.Proxy Classes

    Contains the complete specification of each class in the Microsoft CRM platform.

  • Microsoft.Crm.Platform.Proxy Enumerations

    Contains the enumerations used for parameters to methods within the Microsoft CRM API. These enumerations are not to be used within XML strings.

For more information about finding this assembly, see the How To section.


Microsoft.Crm.Platform.Proxy Classes

The following table lists the classes contained in the namespace Microsoft.Crm.Platform.Proxy.

Class | Description
BizMerchant | Contains methods for managing businesses.
BizOrganization | Contains methods for managing organizations.
BizPrivilege | Contains methods for managing business privileges.
BizTeam | Contains methods for managing teams.
BizUser | Contains methods for managing users.
CBusinessResult | Stores the result from creating a new business.
CObjectName | Stores the type and the ID for an object.
CRMAccount | Contains methods for managing accounts.
CRMActivity | Contains methods for managing activities.
CRMActivityAttachment | Contains methods for managing activity attachments.
CRMAnswer | Contains methods for finding published articles in the knowledge base.
CRMArticle | Contains methods for managing articles.
CRMArticleComment | Contains methods for managing article comments.
CRMArticleTemplate | Contains methods for managing article templates.
CRMBackOfficeHelp | Contains methods used for integration with Microsoft Business Solutions – Great Plains®.
CRMCompetitor | Contains methods for managing competitor information.
CRMContact | Contains methods for managing contacts.
CRMContract | Contains methods for managing application contracts.
CRMContractDetail | Contains methods for managing application contract details.
CRMContractTemplate | Contains methods for managing application contract templates.
CRMCustomerAddress | Contains methods for managing a customer address.
CRMCustomization | Contains methods for managing application customization.
CRMDiscount | Contains methods for managing discounts.
CRMDiscountType | Contains methods for managing discount types.
CRMEmail | Contains methods for managing e-mail.
CRMEmailTemplate | Contains methods for managing e-mail templates.
CRMFiscalCalendar | Contains methods for managing salespeople's quotas.
CRMIncident | Contains methods for managing incidents.
CRMIntegrationState | Contains methods used for integration with Microsoft Business Solutions – Great Plains.
CRMInvoice | Contains methods for managing invoices.
CRMInvoiceDetail | Contains methods for managing invoice details.
CRMLead | Contains methods for managing leads.
CRMLicense | Contains m for managing licenses.
CRMNewsArticle | Contains methods for managing news articles.
CRMNotesManager | Contains methods for managing note objects.
CRMOpportunity | Contains methods for managing opportunities.
CRMOpportunityProduct | Contains methods for managing opportunity products.
CRMPriceLevel | Contains methods for managing price levels.
CRMProcess | Contains methods for managing workflow process objects.
CRMProcessController | Contains methods for managing workflow process instances.
CRMProduct | Contains methods for managing products.
CRMProductPriceLevel | Contains methods for managing product price levels.
CRMQuery | Contains methods for managing queries.
CRMQueue | Contains methods for managing queues.
CRMQueueItem | Contains methods for managing queue items.
CRMQuote | Contains methods for managing quotes.
CRMQuoteDetail | Contains methods for managing quote details.
CRMRichClientSync | Contains methods used to prepare data for synchronization with Microsoft CRM Sales for Outlook.
CRMSalesLiterature | Contains methods for managing sales literature.
CRMSalesLiteratureItem | Contains methods for managing sales literature items.
CRMSalesOrder | Contains methods for managing sales orders.
CRMSalesOrderDetail | Contains methods for managing sales order details.
CRMSalesPerson | Contains methods for managing salespeople.
CRMSubject | Contains methods for managing subjects.
CRMTerritory | Contains methods for managing territories.
CRMUoM | Contains methods for managing unit of measure objects.
CRMUoMSchedule | Contains methods for managing unit of measure schedules.
CRolePrivilege | Stores role privilege information.
CSalesProcessActivity | Stores sales process activity information.
CSalesProcessStage | Stores sales process stage information.
CSecurityPrincipal | Stores information about a security principal.
CUserAuth | Stores user authentication information.
CWorkflowErrorInfo | Stores workflow error information.
CWorkflowProcess | Stores a flat workflow process.
CWorkflowSummary | Stores a summary of a workflow process instance.
ObjectType | Lists the set of possible object types.
PRIVILEGE_DEPTH | Lists privilege depths.
QUEUE_TYPE_CODE | Lists queue type codes.
ROUTE_TYPE_CODE | Lists route type codes.
SAVED_QUERY_TYPE | Lists saved query types.
SecRole | Contains methods for managing security roles.
SecurityPrincipalType | Contains a list of security principal types.
WORKFLOW_ERROR_SEVERITY | Lists workflow error severity.
WORKFLOW_PROCESS_TYPE | Lists workflow process types.


CBusinessResult Class

The CBusinessResult class stores the result from creating a new business.

System.Object
   CBusinessResult
[Visual Basic .NET]
Public Class CBusinessResult
   Inherits System.Object
[C#]
public class CBusinessResult: System.Object
[C++]
public __gc class CBusinessResult: public System.Object

The CBusinessResult class exposes the following members.

Constructor | Description
CBusinessResult | The constructor for the class.
Field | Description
BusinessId | Specifies the ID for the new business.
UserId | Specifies the ID for the new user.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CBusinessResult Constructor

This is the constructor for the class.

Syntax

[Visual Basic .NET]
Public Sub CBusinessResult()
[C#]
public CBusinessResult();
[C++]
public: CBusinessResult();

Parameters

This method takes no parameters.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CBusinessResult Class


CBusinessResult.BusinessId Field

Specifies the ID for the new business.

Syntax

[Visual Basic .NET]
Public Field BusinessId As String
[C#]
public string BusinessId;
[C++]
public: String* BusinessId;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CBusinessResult Class


CBusinessResult.UserId Field

Specifies the ID for the new user.

Syntax

[Visual Basic .NET]
Public Field UserId As String
[C#]
public string UserId;
[C++]
public: String* UserId;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CBusinessResult Class


CObjectName Class

The CObjectName class stores the type and the ID of an object.

System.Object
   CObjectName
[Visual Basic .NET]
Public Class CObjectName
   Inherits System.Object
[C#]
public class CObjectName: System.Object
[C++]
public __gc class CObjectName: public System.Object

The CObjectName class exposes the following members.

Constructor | Description
CObjectName | The constructor for the class.
Field | Description
Id | Specifies the ID for the object.
Type | Specifies the type of the object. Assign a value to this field using the Microsoft.Crm.Platform.Proxy.ObjectType enumeration.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CObjectName Constructor

This is the constructor for the class.

Syntax

[Visual Basic .NET]
Public Sub CObjectName()
[C#]
public CObjectName();
[C++]
public: CObjectName();

Parameters

This method takes no parameters.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CObjectName Class


CObjectName.Id Field

Specifies the ID for the object.

Syntax

[Visual Basic .NET]
Public Field Id As String
[C#]
public string Id;
[C++]
public: String* Id;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CObjectName Class


CObjectName.Type Field

Specifies the type of the object. Assign a value to this field using the Microsoft.Crm.Platform.Proxy.ObjectType enumeration.

Syntax

[Visual Basic .NET]
Public Field Type As ObjectType
[C#]
public ObjectType Type;
[C++]
public: ObjectType Type;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CObjectName Class


CRolePrivilege Class

The CRolePrivilege class stores role privilege information.

System.Object
   CRolePrivilege
[Visual Basic .NET]
Public Class CRolePrivilege
   Inherits System.Object
[C#]
public class CRolePrivilege: System.Object
[C++]
public __gc class CRolePrivilege: public System.Object

The CRolePrivilege class exposes the following members.

Constructor | Description
CRolePrivilege | The constructor for the class.
Field | Description
Depth | Specifies the depth of the privilege. Assign a value to this field using the Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH enumeration.
PrivilegeId | Specifies the ID for the privilege.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRolePrivilege Constructor

This is the constructor for the class.

Syntax

[Visual Basic .NET]
Public Sub CRolePrivilege()
[C#]
public CRolePrivilege();
[C++]
public: CRolePrivilege();

Parameters

This method takes no parameters.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRolePrivilege Class


CRolePrivilege.Depth Field

Specifies the depth of the privilege. Assign a value to this field using the Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH enumeration.

Syntax

[Visual Basic .NET]
Public Field Depth As PRIVILEGE_DEPTH
[C#]
public PRIVILEGE_DEPTH Depth;
[C++]
public: PRIVILEGE_DEPTH Depth;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRolePrivilege Class


CRolePrivilege.PrivilegeId Field

Specifies the ID for the privilege.

Syntax

[Visual Basic .NET]
Public Field PrivilegeId As String
[C#]
public string PrivilegeId;
[C++]
public: String* PrivilegeId;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRolePrivilege Class


CSalesProcessActivity Class

The CSalesProcessActivity class stores sales process activity information. It is returned from the method CRMProcessController::RetrieveSalesProcessActivities.

System.Object
   CSalesProcessActivity
[Visual Basic .NET]
Public Class CSalesProcessActivity
   Inherits System.Object
[C#]
public class CSalesProcessActivity: System.Object
[C++]
public __gc class CSalesProcessActivity: public System.Object

The CSalesProcessActivity class exposes the following members.

Constructor | Description
CSalesProcessActivity | The constructor for the class.
Field | Description
ActivityId | Specifies the ID for the activity.
ActivityName | Specifies the name of the activity.
ActivityState | Specifies the activity state. The value of this field is from the Microsoft.Crm.Platform.Types.ACTIVITY_STATE class
ActivityType | Specifies the activity type. The value of this field is from the Microsoft.Crm.Platform.Types.ObjectType class.
StageId | Specifies the stage ID for the activity.
StageName | Specifies the stage name for the activity.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CSalesProcessActivity Constructor

This is the constructor for the class.

Syntax

[Visual Basic .NET]
Public Sub CSalesProcessActivity()
[C#]
public CSalesProcessActivity();
[C++]
public: CSalesProcessActivity();

Parameters

This method takes no parameters.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSalesProcessActivity Class


CSalesProcessActivity.ActivityId Field

Specifies the ID for the activity.

Syntax

[Visual Basic .NET]
Public Field ActivityId As String
[C#]
public string ActivityId;
[C++]
public: String* ActivityId;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSalesProcessActivity Class


CSalesProcessActivity.ActivityName Field

Specifies the name of the activity.

Syntax

[Visual Basic .NET]
Public Field ActivityName As String
[C#]
public string ActivityName;
[C++]
public: String* ActivityName;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSalesProcessActivity Class


CSalesProcessActivity.ActivityState Field

Specifies the activity state. The value of this field is from the Microsoft.Crm.Platform.Types.ACTIVITY_STATE class.

Syntax

[Visual Basic .NET]
Public Field ActivityState As Integer
[C#]
public int ActivityState;
[C++]
public: long ActivityState;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSalesProcessActivity Class


CSalesProcessActivity.ActivityType Field

Specifies the type of the activity. The value of this field is from the Microsoft.Crm.Platform.Types.ObjectType class.

Syntax

[Visual Basic .NET]
Public Field ActivityType As Integer
[C#]
public int ActivityType;
[C++]
public: long ActivityType;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSalesProcessActivity Class


CSalesProcessActivity.StageId Field

Specifies the stage ID for the activity.

Syntax

[Visual Basic .NET]
Public Field StageId As String
[C#]
public string StageId;
[C++]
public: String* StageId;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSalesProcessActivity Class


CSalesProcessActivity.StageName Field

Specifies the name of the stage for the activity.

Syntax

[Visual Basic .NET]
Public Field StageName As String
[C#]
public string StageName;
[C++]
public: String* StageName;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSalesProcessActivity Class


CSalesProcessStage Class

The CSalesProcessStage class stores sales process stage information. This class is returned from the method CRMProcessController::RetrieveSalesProcessStages.

System.Object
   CSalesProcessStage
[Visual Basic .NET]
Public Class CSalesProcessStage
   Inherits System.Object
[C#]
public class CSalesProcessStage: System.Object
[C++]
public __gc class CSalesProcessStage: public System.Object

The CSalesProcessStage class exposes the following members.

Constructor | Description
CSalesProcessStage | The constructor for the class.
Field | Description
StageId | Specifies the ID for the stage.
StageName | Specifies the name of the stage.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CSalesProcessStage Constructor

This is the constructor for the class.

Syntax

[Visual Basic .NET]
Public Sub CSalesProcessStage()
[C#]
public CSalesProcessStage();
[C++]
public: CSalesProcessStage();

Parameters

This method takes no parameters.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSalesProcessStage Class


CSalesProcessStage.StageId Field

Specifies the ID for the stage.

Syntax

[Visual Basic .NET]
Public Field StageId As String
[C#]
public string StageId;
[C++]
public: String* StageId;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSalesProcessStage Class


CSalesProcessStage.StageName Field

Specifies the name of the stage.

Syntax

[Visual Basic .NET]
Public Field StageName As String
[C#]
public string StageName;
[C++]
public: String* StageName;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSalesProcessStage Class


CSecurityPrincipal Class

The CSecurityPrincipal class stores information that describes a security principal.

System.Object
   CSecurityPrincipal
[Visual Basic .NET]
Public Class CSecurityPrincipal
   Inherits System.Object
[C#]
public class CSecurityPrincipal: System.Object
[C++]
public __gc class CSecurityPrincipal: public System.Object

The CSecurityPrincipal class exposes the following members.

Constructor | Description
CSecurityPrincipal | The constructor for the class.
Field | Description
Id | Specifies the ID for the security principal.
Type | Specifies the type of the security principal. Assign a value to this field using the Microsoft.Crm.Platform.Proxy.SecurityPrincipalType enumeration.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CSecurityPrincipal Constructor

This is the constructor for the class.

Syntax

[Visual Basic .NET]
Public Sub CSecurityPrincipal()
[C#]
public CSecurityPrincipal();
[C++]
public: CSecurityPrincipal();

Parameters

This method takes no parameters.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSecurityPrincipal Class


CSecurityPrincipal.Id Field

Specifies the ID for the security principal.

Syntax

[Visual Basic .NET]
Public Field Id As String
[C#]
public string Id;
[C++]
public: String* Id;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSecurityPrincipal Class


CSecurityPrincipal.Type Field

Specifies the type of the security principal. Assign a value to this field using the Microsoft.Crm.Platform.Proxy.SecurityPrincipalType enumeration.

Syntax

[Visual Basic .NET]
Public Field Type As SecurityPrincipalType
[C#]
public SecurityPrincipalType Type;
[C++]
public: SecurityPrincipalType Type;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CSecurityPrincipal Class


CUserAuth Class

The CUserAuth class stores user authentication information.

System.Object
   CUserAuth
[Visual Basic .NET]
Public Class CUserAuth
   Inherits System.Object
[C#]
public class CUserAuth: System.Object
[C++]
public __gc class CUserAuth: public System.Object

The CUserAuth class exposes the following members.

Constructor | Description
CUserAuth | The constructor for the class.
Field | Description
MerchantId | Specifies ID for the business to which the user belongs.
UserId | Specifies ID for the user.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CUserAuth Constructor

This is the constructor for the class.

Syntax

[Visual Basic .NET]
Public Sub CUserAuth()
[C#]
public CUserAuth();
[C++]
public: CUserAuth();

Parameters

This method takes no parameters.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CUserAuth Class


CUserAuth.MerchantId Field

Specifies the ID for the business to which the user belongs.

Syntax

[Visual Basic .NET]
Public Field MerchantId As String
[C#]
public string MerchantId;
[C++]
public: String* MerchantId;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CUserAuth Class


CUserAuth.UserId Field

Specifies the ID for the user.

Syntax

[Visual Basic .NET]
Public Field UserId As String
[C#]
public string UserId;
[C++]
public: String* UserId;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CUserAuth Class


CWorkflowErrorInfo Class

The CWorkflowErrorInfo class stores workflow error information. This class is returned from the CRMProcess::Activate method.

System.Object
   CWorkflowErrorInfo
[Visual Basic .NET]
Public Class CWorkflowErrorInfo
   Inherits System.Object
[C#]
public class CWorkflowErrorInfo: System.Object
[C++]
public __gc class CWorkflowErrorInfo: public System.Object

The CWorkflowErrorInfo class exposes the following members.

Constructor | Description
CWorkflowErrorInfo | The constructor for the class.
Field | Description
Description | Specifies the description of the error.
ObjectId | Specifies the ID for the object.
SCode | Specifies the scode of the error. See Error Codes.
Severity | Specifies the error severity. The value of this field is from the Microsoft.Crm.Platform.Proxy.WORKFLOW_ERROR_SEVERITY enumeration.
Type | Specifies the object type. The value of this field is from the Microsoft.Crm.Platform.Proxy.ObjectType enumeration.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CWorkflowErrorInfo Constructor

This is the constructor for the class.

Syntax

[Visual Basic .NET]
Public Sub CWorkflowErrorInfo()
[C#]
public CWorkflowErrorInfo();
[C++]
public: CWorkflowErrorInfo();

Parameters

This method takes no parameters.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowErrorInfo Class


CWorkflowErrorInfo.Description Field

Specifies the description of the error.

Syntax

[Visual Basic .NET]
Public Field Description As String
[C#]
public string Description;
[C++]
public: String* Description;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowErrorInfo Class


CWorkflowErrorInfo.ObjectId Field

Specifies the ID for the object.

Syntax

[Visual Basic .NET]
Public Field ObjectId As String
[C#]
public string ObjectId;
[C++]
public: String* ObjectId;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowErrorInfo Class


CWorkflowErrorInfo.SCode Field

Specifies the scode for the error. See Error Codes.

Syntax

[Visual Basic .NET]
Public Field SCode As Integer
[C#]
public int SCode;
[C++]
public: long SCode;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowErrorInfo Class


CWorkflowErrorInfo.Severity Field

Specifies the error severity. The value of this field is from the Microsoft.Crm.Platform.Proxy.WORKFLOW_ERROR_SEVERITY enumeration.

Syntax

[Visual Basic .NET]
Public Field Severity As WORKFLOW_ERROR_SEVERITY
[C#]
public WORKFLOW_ERROR_SEVERITY Severity;
[C++]
public: WORKFLOW_ERROR_SEVERITY Severity;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowErrorInfo Class


CWorkflowErrorInfo.Type Field

Specifies the object type. The value of this field is from the Microsoft.Crm.Platform.Proxy.ObjectType enumeration.

Syntax

[Visual Basic .NET]
Public Field Type As ObjectType
[C#]
public ObjectType Type;
[C++]
public: ObjectType Type;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowErrorInfo Class


CWorkflowProcess Class

The CWorkflowProcess class stores a flat workflow process in XML format. This class is used for CrmProcess CreateAll, RetrieveAll and UpdateAll methods. When constructing the XML strings for this class, GUIDS are used to specify the relationships between the objects.

Note You can obtain a new GUID in Microsoft Visual C.NET with the following code:

string GUID = System.Guid.NewGuid().ToString("B").ToUpper();
System.Object
   CWorkflowProcess
[Visual Basic .NET]
Public Class CWorkflowProcess
   Inherits System.Object
[C#]
public class CWorkflowProcess: System.Object
[C++]
public __gc class CWorkflowProcess: public System.Object

The CWorkflowProcess class exposes the following members.

Constructor | Description
CWorkflowProcess | The constructor for the class.
Field | Description
ActionParameters Specifies the XML string that describes the action parameters. This XML string is in the format
<wfparameters> + parameter1..N + </wfparameters>

where the XML schema for parameter X is described by wfparameter.xsd.
Actions Specifies the XML string that describes the actions. This XML string is in the format
<wfactions> + action1..N + </wfactions>

where the XML schema for action X is described by wfaction.xsd.
ConditionParameters Specifies the XML string that describes the condition parameters. This XML string is in the format
<wfparameters> + parameter1..N + </wfparameters>

where the XML schema for parameter X is described by wfparameter.xsd.
Conditions Specifies the XML string that describes the conditions. This XML string is in the format
<wfconditions> + condition1..N + </wfconditions>

where the XML schema for condition X is described by wfcondition.xsd.
Process | Specifies the XML string that describes the workflow process. The XML schema is described by wfprocess.xsd.
Rules Specifies the XML string that describes the rules. This XML string is in the format
<wfrules> + rule1..N + </wfrules>

where the XML schema for rule X is described by wfrule.xsd.
Steps Specifies the XML string that describes the steps. This XML string is in the format
<wfsteps> + step1..N + </wfsteps>

where the XML schema for step X is described by wfstep.xsd.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes
  • Workflow Reference


CWorkflowProcess Constructor

This is the constructor for the class.

Syntax

[Visual Basic .NET]
Public Sub CWorkflowProcess()
[C#]
public CWorkflowProcess();
[C++]
public: CWorkflowProcess();

Parameters

This method takes no parameters.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowProcess Class


CWorkflowProcess.ActionParameters Field

Specifies the XML string that describes the action parameters. This XML string is in the format:

<wfparameters> + parameter1..N + </wfparameters>

where the XML schema for parameter X is described by wfparameter.xsd.

Syntax

[Visual Basic .NET]
Public Field ActionParameters As String
[C#]
public string ActionParameters;
[C++]
public: String* ActionParameters;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowProcess Class
  • Workflow Reference


CWorkflowProcess.Actions Field

Specifies the XML string that describes the actions. This XML string is in the format

<wfactions> + action1..N + </wfactions>

where the XML schema for action X is described by wfaction.xsd.

Syntax

[Visual Basic .NET]
Public Field Actions As String
[C#]
public string Actions;
[C++]
public: String* Actions;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowProcess Class
  • Workflow Reference


CWorkflowProcess.ConditionParameters Field

Specifies the XML string that describes the condition parameters. This XML string is in the format

<wfparameters> + parameter1..N + </wfparameters>

where the XML schema for parameter X is described by wfparameter.xsd.

Syntax

[Visual Basic .NET]
Public Field ConditionParameters As String
[C#]
public string ConditionParameters;
[C++]
public: String* ConditionParameters;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowProcess Class
  • Workflow Reference


CWorkflowProcess.Conditions Field

Specifies the XML string that describes the conditions. This XML string is in the format

<wfconditions> + condition1..N + </wfconditions>

where the XML schema for condition X is described by wfcondition.xsd.

Syntax

[Visual Basic .NET]
Public Field Conditions As String
[C#]
public string Conditions;
[C++]
public: String* Conditions;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowProcess Class
  • Workflow Reference


CWorkflowProcess.Process Field

Specifies the XML string that describes the workflow process. The XML schema is described by wfprocess.xsd.

Syntax

[Visual Basic .NET]
Public Field Process As String
[C#]
public string Process;
[C++]
public: String* Process;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowProcess Class
  • Workflow Reference


CWorkflowProcess.Rules Field

Specifies the XML string that describes the rules. This XML string is in the format

<wfrules> + rule1..N + </wfrules>

where the XML schema for rule X is described by wfrule.xsd.

Syntax

[Visual Basic .NET]
Public Field Rules As String
[C#]
public string Rules;
[C++]
public: String* Rules;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowProcess Class
  • Workflow Reference


CWorkflowProcess.Steps Field

Specifies the XML string that describes the steps. This XML string is in the format

<wfsteps> + step1..N + </wfsteps>

where the XML schema for step X is described by wfstep.xsd.

Syntax

[Visual Basic .NET]
Public Field Steps As String
[C#]
public string Steps;
[C++]
public: String* Steps;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes
  • Workflow Reference


CWorkflowSummary Class

The CWorkflowSummary class stores the workflow process instance summary. This class is returned from the method CRMProcessController::RetrieveProcessInstancesSummary.

System.Object
   CWorkflowSummary
[Visual Basic .NET]
Public Class CWorkflowSummary
   Inherits System.Object
[C#]
public class CWorkflowSummary: System.Object
[C++]
public __gc class CWorkflowSummary: public System.Object

The CWorkflowSummary class exposes the following integer fields.

Constructor | Description
CWorkflowSummary | The constructor for the class.
Field | Description
Count | The number of process instances with the specified ObjectType and StateCode.
ObjectType | Specifies the object type. The value of this field is from the Microsoft.Crm.Platform.Types.ObjectType class.
StateCode | Specifies the state code. The value of this field is from the WORKFLOW_PROCESS_INSTANCE_STATE class.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CWorkflowSummary Constructor

This is the constructor for the class.

Syntax

[Visual Basic .NET]
Public Sub CWorkflowSummary()
[C#]
public CWorkflowSummary();
[C++]
public: CWorkflowSummary();

Parameters

This method takes no parameters.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowSummary Class


CWorkflowSummary.Count Field

Specifies the number of process instances with the specified ObjectType and StateCode fields.

Syntax

[Visual Basic .NET]
Public Field Count As Integer
[C#]
public int Count;
[C++]
public: long Count;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowSummary Class


CWorkflowSummary.ObjectType Field

Specifies the object type. The value of this field is from the Microsoft.Crm.Platform.Types.ObjectType class.

Syntax

[Visual Basic .NET]
Public Field ObjectType As Integer
[C#]
public int ObjectType;
[C++]
public: long ObjectType;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowSummary Class


CWorkflowSummary.StateCode Field

Specifies the state code. The value of this field is from the WORKFLOW_PROCESS_INSTANCE_STATE class.

Syntax

[Visual Basic .NET]
Public Field StateCode As Integer
[C#]
public int StateCode;
[C++]
public: long StateCode;

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CWorkflowSummary Class


BizMerchant Class

The BizMerchant class contains methods that you can use to manage business units.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  BizMerchant
[Visual Basic .NET]
Public Class BizMerchant
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class BizMerchant : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class BizMerchant: public System.Web.Services.Protocols.SoapHttpClientProtocol

The BizMerchant class exposes the following methods.

Method | Description
ChangeName | Changes business unit name.
Create | Creates a child business unit and a user in the child business unit.
CreateAndRetrieve | Creates a child business unit and a user in the child business unit, and then retrieves the newly created business unit and user information.
Disable | Disables a business unit and all its child business units.
Enable | Enables a previously disabled business unit and all its child business units.
Retrieve | Retrieves business unit information for the specified business unit.
RetrieveAllTeams | Retrieves all teams in the specified business unit hierarchy.
RetrieveAllUsers | Retrieves all users in the specified business unit hierarchy.
RetrieveBusinessHierarchy | Retrieves all business units in the business unit hierarchy.
RetrieveChildBusinesses | Retrieves all child business units in the specified business unit hierarchy.
RetrieveMerchant | Retrieves the business information for the root business unit.
RetrieveOrganization | Retrieves information for an organization.
RetrieveParent | Retrieves parent business unit information for a business unit.
RetrieveSubBusinesses | Retrieves the child business units of a business unit.
RetrieveSubsidiaryTeams | Retrieves all team information from child business units of the specified business unit.
RetrieveSubsidiaryUsers | Retrieves all user information from child business units of the specified business unit.
RetrieveTeams | Retrieves the teams in the given business unit.
RetrieveUsers | Retrieves the users in the given business unit.
SetInheritanceMask | Sets the inheritance mask for a business unit.
SetParent | Moves the specified child business unit to a parent of another business unit.
Update | Updates business information.
UpdateAndRetrieve | Updates business information and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


BizMerchant.ChangeName Method

The ChangeName method changes the name of a business unit.

Syntax

[Visual Basic .NET]
Public Sub ChangeName(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal NewName As String
)
[C#]
public void ChangeName(
  CUserAuth  Caller,
  string  BusinessId,
  string  NewName
);
[C++]
public: void ChangeName(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  NewName
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business. This ID is specified by the platform and obtained at creation time.
NewName
Specifies a new name for the business unit.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   merchant.ChangeName(userAuth, userAuth.MerchantId, "Adventure Works");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class


BizMerchant.Create Method

The Create method creates a child business unit and a user in the child business unit.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal BusinessXML As String,
  ByVal UserXML As String
) As CBusinessResult
[C#]
public CBusinessResult Create(
  CUserAuth  Caller,
  string  BusinessXML,
  string  UserXML
);
[C++]
public: CBusinessResult* Create(
  CUserAuth*  Caller,
  String*  BusinessXML,
  String*  UserXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateBusinessUnit privilege to perform this action. See CUserAuth.
BusinessXML
Specifies an XML string containing the business information. The XML schema is described by businessunit.xsd.
UserXML
Specifies an XML string containing the user information. The XML schema is described by systemuser.xsd.

Return Value

Returns a CBusinessResult type that contains the newly created business unit ID and user ID.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the business unit
   string strBusiness = "<businessunit>";
   strBusiness += "<parentbusinessunitid>" + userAuth.MerchantId + "</parentbusinessunitid>";
   strBusiness += "<name>" + "Adventure Works" + "</name>";
   strBusiness += "<description>Description of My Business</description>";
   strBusiness += "</businessunit>";

   string sUserName = "Fukiko Ogisu";

   // The domainname field must map to an existing Active Directory user name
   //However, if that name has already been used to create a user, it cannot be reused
   string strUserXml = "<systemuser><domainname>" + sUserName + "</domainname></systemuser>";

   Microsoft.Crm.Platform.Proxy.CBusinessResult result= merchant.Create(userAuth, strBusiness, strUserXml);
// result now contains the new business ID and the user ID
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class


BizMerchant.CreateAndRetrieve Method

The CreateAndRetrieve method creates a child business unit and a user in the child business unit, and then retrieves the newly created business unit and user information.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal BusinessXML As String,
  ByVal UserXML As String,
  ByRef OutUserXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  BusinessXML,
  string  UserXML,
  out string  OutUserXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  BusinessXML,
  String*  UserXML,
  String**  OutUserXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateBusinessUnit and prvReadBusinessUnit privileges to perform this action. See CUserAuth.
BusinessXML
Specifies an XML string containing the business information. The XML schema is described by businessunit.xsd.
UserXML
Specifies an XML string containing the user information. The XML schema is described by systemuser.xsd.
OutUserXML
[out] Specifies an XML string containing the newly created user information. The XML schema is described by systemuser.xsd.

Return Value

Returns a String type that specifies the XML data containing the newly created business unit. The XML schema is described by businessunit.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the business unit
   string strBusiness = "<businessunit>";
   strBusiness+= "<parentbusinessunitid>" + userAuth.MerchantId + "</parentbusinessunitid>";
   strBusiness+= "<name>" + "Adventure Works" + "</name>";
   strBusiness+= "<description>" + "My Business Description" + "</description>";
   strBusiness+= "</businessunit>";

   string sUserName = "Fukiko Ogisu";
   string strUserXml = "<systemuser><domainname>" + sUserName + "</domainname></systemuser>";;

   string strOutUserXml;
   string strResultXml = merchant.CreateAndRetrieve(userAuth, strBusiness, strUserXml, out strOutUserXml);
// Now strResultXml contains the newly created business information,
// and strOutUserXml contains the newly created user information
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}
      }

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class


BizMerchant.Disable Method

The Disable method disables a business unit and all of its child business units. No user in the business unit can log on to the Microsoft CRM service after the business unit is disabled.

Syntax

[Visual Basic .NET]
Public Sub Disable(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal Reason As String
)
[C#]
public void Disable(
  CUserAuth  Caller,
  string  BusinessId,
  string  Reason
);
[C++]
public: void Disable(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  Reason
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDisableBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.
Reason
Specifies the reason for disabling the business unit.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strBusinessId = "{4807B998-6B4F-4D57-9CF6-515F50E43D79}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Disable the merchant
   merchant.Disable(userAuth, strBusinessId, "In Bankruptcy Proceedings");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Enable


BizMerchant.Enable Method

The Enable method enables a previously disabled business unit and all of its child business units. A previously disabled child business unit and its child business units will be enabled as well. The users in the business unit who do not have disabled user records themselves will be able to log on to the Microsoft CRM service again.

Syntax

[Visual Basic .NET]
Public Sub Enable(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String
)
[C#]
public void Enable(
  CUserAuth  Caller,
  string  BusinessId
);
[C++]
public: void Enable(
  CUserAuth*  Caller,
  String*  BusinessId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDisableBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strBusinessId = "{4807B998-6B4F-4D57-9CF6-515F50E43D79}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Enable the merchant
   merchant.Enable(userAuth, strBusinessId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Disable


BizMerchant.Retrieve Method

The Retrieve method retrieves business information for the specified business unit.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  BusinessId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit to retrieve.
ColumnSetXml
Specifies an XML string describing the fields you would like returned for each team. Passing "" or null returns all columns. The XML schema is described by businessunit.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the business unit information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by businessunit.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strColumnSetXml;
string strResultXml;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>businessunitid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>address1_line1</column>";
   strColumnSetXml += "<column>address1_line2</column>";
   strColumnSetXml += "<column>address1_line3</column>";
   strColumnSetXml += "<column>address1_city</column>";
   strColumnSetXml += "<column>address1_stateorprovince</column>";
   strColumnSetXml += "<column>address1_postalcode</column>";
   strColumnSetXml += "<column>address1_telephone1</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the merchant
   strResultXml = merchant.Retrieve(userAuth, userAuth.MerchantId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}
      }

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • RetrieveAllTeams
  • RetrieveAllUsers
  • RetrieveBusinessHierarchy
  • RetrieveChildBusinesses
  • RetrieveMerchant
  • RetrieveParent
  • RetrieveSubBusinesses
  • RetrieveTeams
  • RetrieveUsers


BizMerchant.RetrieveAllTeams Method

The RetrieveAllTeams method retrieves all teams in the specified business unit hierarchy.

Syntax

[Visual Basic .NET]
Public Function RetrieveAllTeams(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveAllTeams(
  CUserAuth  Caller,
  string  BusinessId,
  string  ColumnSet
);
[C++]
public: String* RetrieveAllTeams(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.
ColumnSet
Specifies an XML string describing the fields you would like returned for each team. Passing "" or null returns all columns. The XML schema is described by team.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that contains the XML data listing teams in the business unit. The fields that are returned for each team depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<teams> + team1..N + </teams>

where the XML schema for each team is described by team.xsd.

Remarks

The team XML data that is returned is not in hierarchical format. Instead, it is a flat format, as shown in the following example:

Business hierarchy:

                 B0 - t01, t02
                /  \
  t11, t12 - B1     B2 - t21, t22

A call to RetrieveAllTeams for business unit B0 returns the following XML data:

<teams>
   <team>t01 fields</team>
   <team>t02 fields</team>
   <team>t11 fields</team>
   <team>t12 fields</team>
   <team>t21 fields</team>
   <team>t22 fields</team>
</teams>

Note This order is not guaranteed unless OrderXml is specified in the ColumnSet parameter. See ColumnSetXML Schema.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action,
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strColumnSetXml;
string strResultXml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>teamid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>emailaddress</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve all of the teams that are associated with the merchant
   strResultXml = merchant.RetrieveAllTeams(userAuth, userAuth.MerchantId, strColumnSetXml);

} catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Retrieve


BizMerchant.RetrieveAllUsers Method

The RetrieveAllUsers method retrieves all users in the specified business unit hierarchy.

Syntax

[Visual Basic .NET]
Public Function RetrieveAllUsers(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveAllUsers(
  CUserAuth  Caller,
  string  BusinessId,
  string  ColumnSet
);
[C++]
public: String* RetrieveAllUsers(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.
ColumnSet
Specifies an XML string describing the fields you would like returned for each user. Passing "" or null returns all columns. The XML schema is described by systemuser.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that contains the XML data listing all of the users. The fields that are returned for each user depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<systemusers> + systemuser1..N + </systemusers>

where the XML schema for each user is described by systemuser.xsd.

Remarks

The user XML data that is returned is not in the hierarchical format. Instead, it is a flat format, as shown in the following example:

Business hierarchy:

                  B0 - u01, u02
                 /  \
    u11, u12 - B1     B2 - u21, u22

A call to RetrieveAllUsers for business unit B0 returns the following XML data:

<systemusers>
   <systemuser>u01 fields</systemuser>
   <systemuser>u02 fields</systemuser>
   <systemuser>u11 fields</systemuser>
   <systemuser>u12 fields</systemuser>
   <systemuser>u21 fields</systemuser>
   <systemuser>u22 fields</systemuser>
</systemusers>

Note This order is not guaranteed unless OrderXml is specified in the ColumnSet parameter. See ColumnSetXML Schema.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

// Set up the columns that you want to retrieve
string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>systemuserid</column>";
   strColumnSetXml += "<column>fullname</column>";
   strColumnSetXml += "<column>personalemailaddress</column>";
   strColumnSetXml += "</columnset>";

   string strResultXml = merchant.RetrieveAllUsers(userAuth, userAuth.MerchantId, strColumnSetXml);
// Now strResultXml should contain all users in the business unit hierarchy
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Retrieve


BizMerchant.RetrieveBusinessHierarchy Method

The RetrieveBusinessHierarchy method retrieves all business units (including the specified business unit) in the business unit hierarchy.

Syntax

[Visual Basic .NET]
Public Function RetrieveBusinessHierarchy(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveBusinessHierarchy(
  CUserAuth  Caller,
  string  BusinessId,
  string  ColumnSet
);
[C++]
public: String* RetrieveBusinessHierarchy(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.
ColumnSet
Specifies an XML string describing the fields you would like returned for each child business unit. Passing "" or null returns all columns. The XML schema is described by businessunit.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that contains the XML data listing all the business units. The fields that are returned for each business unit depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<businessunits> + businessunit1..N + </businessunits>

where the XML schema for each business unit is described by businessunit.xsd.

Remarks

The returned child business unit XML data is not in the hierarchical format. Instead, it is a flat format, as shown in the following example:

Business hierarchy:

        B
     /     \
    B1      B2
   / \      / \
 B11 B12  B21 B22

A call to RetrieveBusinessHierarchy for business unit B returns the following XML data:

<businessunits>
   <businessunit>B fields</businessunit>
   <businessunit>B1 fields</businessunit>
   <businessunit>B2 fields</businessunit>
   <businessunit>B11 fields</businessunit>
   <businessunit>B12 fields</businessunit>
   <businessunit>B21 fields</businessunit>
   <businessunit>B22 fields</businessunit>
</businessunits>

Note This order is not guaranteed unless OrderXml is specified in the ColumnSet parameter. See ColumnSetXML Schema.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>businessunitid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   string strResultXml = merchant.RetrieveBusinessHierarchy(userAuth, userAuth.MerchantId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Retrieve


BizMerchant.RetrieveChildBusinesses Method

The RetrieveChildBusinesses method retrieves all child business units in the given business unit hierarchy.

Syntax

[Visual Basic .NET]
Public Function RetrieveChildBusinesses(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveChildBusinesses(
  CUserAuth  Caller,
  string  BusinessId,
  string  ColumnSet
);
[C++]
public: String* RetrieveChildBusinesses(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.
ColumnSet
Specifies an XML string describing the fields you would like returned for each child business unit. Passing "" or null returns all columns. The XML schema is described by businessunit.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that contains the XML data listing all the child business units. The fields that are returned for each child business unit depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<businessunits> + businessunit1..N + </businessunits>

where the XML schema for each business unit is described by businessunit.xsd.

Remarks

The returned child business unit XML data is not in the hierarchical format. Instead, it is a flat format, as shown in the following example:

Business hierarchy:

        B
     /     \
    B1      B2
   / \      / \
 B11 B12  B21 B22

A call to RetrieveChildBusinesses for business unit B returns the following XML data:

<businessunits>
   <businessunit>B1 fields</businessunit>
   <businessunit>B2 fields</businessunit>
   <businessunit>B11 fields</businessunit>
   <businessunit>B12 fields</businessunit>
   <businessunit>B21 fields</businessunit>
   <businessunit>B22 fields</businessunit>
</businessunits>

Note This order is not guaranteed unless OrderXml is specified in the ColumnSet parameter. See ColumnSetXML Schema.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>businessunitid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   string strResultXml = merchant.RetrieveChildBusinesses(userAuth, userAuth.MerchantId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Retrieve


BizMerchant.RetrieveMerchant Method

The RetrieveMerchant method retrieves the business information for the root business unit.

Syntax

[Visual Basic .NET]
Public Function RetrieveMerchant(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String
) As String
[C#]
public string RetrieveMerchant(
  CUserAuth  Caller,
  string  BusinessId
);
[C++]
public: String* RetrieveMerchant(
  CUserAuth*  Caller,
  String*  BusinessId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.

Return Value

Returns a String type that contains the XML data describing the business information. The XML schema is described by businessunit.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strResultXml = merchant.RetrieveMerchant(userAuth, userAuth.MerchantId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Retrieve


BizMerchant.RetrieveOrganization Method

The RetrieveOrganization method retrieves the information for an organization.

Syntax

[Visual Basic .NET]
Public Function RetrieveOrganization(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveOrganization(
  CUserAuth  Caller,
  string  BusinessId,
  string  ColumnSet
);
[C++]
public: String* RetrieveOrganization(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.
ColumnSet
Specifies an XML string describing the fields you would like returned for each user. Passing "" or null returns all columns. The XML schema is described by organization.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the organization information. The XML schema is described by organization.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>organizationid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   string strResultXml = merchant.RetrieveOrganization(userAuth, userAuth.MerchantId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Retrieve


BizMerchant.RetrieveParent Method

The RetrieveParent method retrieves parent business information for a business unit.

Syntax

[Visual Basic .NET]
Public Function RetrieveParent(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String
) As String
[C#]
public string RetrieveParent(
  CUserAuth  Caller,
  string  BusinessId
);
[C++]
public: String* RetrieveParent(
  CUserAuth*  Caller,
  String*  BusinessId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.

Return Value

Returns a String type that specifies the XML data containing the parent business information. The XML schema is described by businessunit.xsd.

Remarks

The method fails if the business unit does not have a parent business unit.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strResultXml = merchant.RetrieveParent(userAuth, userAuth.MerchantId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Retrieve


BizMerchant.RetrieveSubBusinesses Method

The RetrieveSubBusinesses method retrieves the child business units of a business unit.

Syntax

[Visual Basic .NET]
Public Function RetrieveSubBusinesses(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveSubBusinesses(
  CUserAuth  Caller,
  string  BusinessId,
  string  ColumnSet
);
[C++]
public: String* RetrieveSubBusinesses(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies ID of the business unit. This ID is specified by the platform and obtained at creation time.
ColumnSet
Specifies an XML string describing the fields you would like returned for each child business unit. Passing "" or null returns all columns. The XML schema is described by businessunit.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that contains the XML data listing the child business units associated with the specified business unit. The fields that are returned for each child business unit depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<businessunits> + businessunit1..N + </businessunits>

where the XML schema for each business unit is described by businessunit.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>businessunitid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   string strResultXml = merchant.RetrieveSubBusinesses(userAuth, userAuth.MerchantId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

See Also

  • BizMerchant Class
  • Retrieve


BizMerchant.RetrieveSubsidiaryTeams Method

The RetrieveSubsidiaryTeams method retrieves all team information from the child business units of the specified business unit.

Syntax

[Visual Basic .NET]
Public Function RetrieveSubsidiaryTeams(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveSubsidiaryTeams(
  CUserAuth  Caller,
  string  BusinessId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveSubsidiaryTeams(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.
ColumnSeXML
Specifies an XML string describing the fields you would like returned for each team. Passing "" or null returns all columns. The XML schema is described by team.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of teams associated with the specified business unit. The fields that are returned for each team depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<teams> + team1..N + </teams>

where the XML schema for each team is described by team.xsd.

Remarks

The returned team XML data is not in the hierarchical format. Instead, it is a flat format, as shown in the following example:

Team hierarchy:

               B
            /      \
          T1        T2
         / \        / \
       T11 T12    T21 T22

A call to RetrieveSubsidiaryTeams for business unit B returns the following XML data:

<Teams>
   <Team>T1 fields</Team>
   <Team>T2 fields</Team>
   <Team>T11 fields</Team>
   <Team>T12 fields</Team>
   <Team>T21 fields</Team>
   <Team>T22 fields</Team>
</Teams>

Note This order is not guaranteed unless OrderXml is specified in the ColumnSet parameter. See ColumnSetXML Schema.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>teamid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   string strResultXml = merchant.RetrieveSubsidiaryTeams(userAuth, userAuth.MerchantId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Retrieve


BizMerchant.RetrieveSubsidiaryUsers Method

The RetrieveSubsidiaryUsers method retrieves all user information from the child business units of the specified business unit.

Syntax

[Visual Basic .NET]
Public Function RetrieveSubsidiaryUsers(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveSubsidiaryUsers(
  CUserAuth  Caller,
  string  BusinessId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveSubsidiaryUsers(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.
ColumnSetXML
Specifies an XML string describing the fields you would like returned for each user. Passing "" or null returns all columns. The XML schema is described by systemuser.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of child business unit users associated with the specified business unit. The fields that are returned for each user depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<systemusers> + systemuser1..N + </systemusers>

where the XML schema for each user is described by systemuser.xsd.

Remarks

The returned child business unit user XML data is not in the hierarchical format. Instead, it is a flat format, as shown in the following example:

User hierarchy:

               B
            /     \
          U1       U2
         / \       / \
       U11 U12   U21 U22

A call to RetrieveSubsidiaryUsers for business unit B returns the following XML data:

<systemusers>
   <systemuser>U1 fields</systemuser>
   <systemuser>U2 fields</systemuser>
   <systemuser>U11 fields</systemuser>
   <systemuser>U12 fields</systemuser>
   <systemuser>U21 fields</systemuser>
   <systemuser>U22 fields</systemuser>
</systemusers>

Note This order is not guaranteed unless OrderXml is specified in the ColumnSet parameter. See ColumnSetXML Schema.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>systemuserid</column>";
   strColumnSetXml += "<column>fullname</column>";
   strColumnSetXml += "</columnset>";

   string strResultXml = merchant.RetrieveSubsidiaryUsers(userAuth, userAuth.MerchantId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Retrieve


BizMerchant.RetrieveTeams Method

The RetrieveTeams method retrieves the teams in the specified business unit.

Syntax

[Visual Basic .NET]
Public Function RetrieveTeams(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveTeams(
  CUserAuth  Caller,
  string  BusinessId,
  string  ColumnSet
);
[C++]
public: String* RetrieveTeams(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.
ColumnSet
Specifies an XML string describing the fields you would like returned for each team. Passing "" or null returns all columns. The XML schema is described by team.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data listing the teams in the business unit. The fields that are returned for each team depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<teams> + team1..N + </teams>

where the XML schema for each team is described by team.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>teamid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>emailaddress</column>";
   strColumnSetXml += "</columnset>";

   string strResultXml = merchant.RetrieveTeams(userAuth, userAuth.MerchantId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Retrieve


BizMerchant.RetrieveUsers Method

The RetrieveUsers method retrieves the users in the given business unit.

Syntax

[Visual Basic .NET]
Public Function RetrieveUsers(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveUsers(
  CUserAuth  Caller,
  string  BusinessId,
  string  ColumnSet
);
[C++]
public: String* RetrieveUsers(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.
ColumnSet
Specifies an XML string describing the fields you would like returned for each user. Passing "" or null returns all columns. The XML schema is described by systemuser.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data listing the users for the business unit. The fields that are returned for each user depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<systemusers> + systemuser1..N + </systemusers>

where the XML schema for each user is described by systemuser.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>systemuserid</column>";
   strColumnSetXml += "<column>fullname</column>";
   strColumnSetXml += "<column>personalemailaddress</column>";
   strColumnSetXml += "</columnset>";

   string strResultXml = merchant.RetrieveUsers(userAuth, userAuth.MerchantId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Retrieve


BizMerchant.SetInheritanceMask Method

The SetInheritanceMask method sets the inheritance mask for a business unit.

Syntax

[Visual Basic .NET]
Public Sub SetInheritanceMask(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal InheritanceMask As Integer
)
[C#]
public void SetInheritanceMask(
  CUserAuth  Caller,
  string  BusinessId,
  int  InheritanceMask
);
[C++]
public: void SetInheritanceMask(
  CUserAuth*  Caller,
  String*  BusinessId,
  long  InheritanceMask
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.
InheritanceMask
Specifies the new inheritance mask for the business unit. See the Remarks section for more information about this parameter. Also see InheritanceMask.

Return Value

No return value.

Remarks

The MUST_INHERIT bits of the inheritance mask are propagated down the business unit hierarchy if they are set to true.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strBusinessId = "{4807B998-6B4F-4D57-9CF6-515F50E43D79}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set the mask
   merchant.SetInheritanceMask(userAuth, strBusinessId,
         Microsoft.Crm.Platform.Types.InheritanceMask.BIZ_INHERIT_EMAILTEMPLATE &
         Microsoft.Crm.Platform.Types.InheritanceMask.BIZ_INHERIT_PROCESSTEMPLATE);

} catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class


BizMerchant.SetParent Method

The SetParent method moves the specified child business unit to a parent of another business unit.

Syntax

[Visual Basic .NET]
Public Sub SetParent(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ParentId As String
)
[C#]
public void SetParent(
  CUserAuth  Caller,
  string  BusinessId,
  string  ParentId
);
[C++]
public: void SetParent(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ParentId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReparentBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit. This ID is specified by the platform and obtained at creation time.
ParentId
Specifies the ID of the new parent business unit. This ID is specified by the platform and obtained at creation time.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strBusinessId = "{4807B998-6B4F-4D57-9CF6-515F50E43D79}";
string strNewParentId = "{K9920C07-EE2A-4616-A7EC-1E9D280CF535}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set the parent
   merchant.SetParent(userAuth, strBusinessId, strNewParentId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class


BizMerchant.Update Method

The Update method updates business information.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal BusinessXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  BusinessId,
  string  BusinessXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  BusinessXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteBusinessUnit privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit to update.
BusinessXML
Specifies an XML string containing the business information. The XML schema is described by businessunit.xsd.

Return Value

No return value.

Remarks

The following fields cannot be updated by using this method: Name, ParentBusinessUnitId, and IsDisabled. To change these fields, use the ChangeName, SetParent, and Disable methods.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strResultXml;
string strColumnSetXml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the current information
   strResultXml = merchant.Retrieve(userAuth, userAuth.MerchantId, strColumnSetXml);

   // Change the desired data
   XmlDocument xmlDoc = new XmlDocument();
   xmlDoc.LoadXml(strResultXml);

   // Update the description. (Add a description if one is not already there)
   XmlNodeList xmlNodes = xmlDoc.GetElementsByTagName("description");

   if (xmlNodes == null || xmlNodes.Count == 0)
   {
      System.Xml.XmlElement oElement = xmlDoc.CreateElement("description");
      oElement.InnerText  = "A wonderful business.";
      xmlDoc.FirstChild.AppendChild((System.Xml.XmlNode)oElement);
   }
   else
   {
      xmlNodes.Item(0).InnerText = "A wonderful business.";
   }

   strResultXml = xmlDoc.InnerXml;

   // Update the business
   merchant.Update(userAuth, userAuth.MerchantId, strResultXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • Create
  • UpdateAndRetrieve


BizMerchant.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates business information and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal InBusinessXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  BusinessId,
  string  InBusinessXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  InBusinessXML
);

Parameters

Caller

Specifies the identity of the caller. The caller must have the prvWriteBusinessUnit and prvReadBusinessUnit privileges to perform this action. See CUserAuth.

BusinessId
Specifies the ID of the business unit to update.
InBusinessXML
Specifies an XML string containing the business information. The XML schema is described by businessunit.xsd.

Return Value

Returns a String type that specifies the XML data containing the updated business information. The XML schema is described by businessunit.xsd.

Remarks

The following fields cannot be updated by using this method: Name, ParentBusinessUnitId, and IsDisabled. To change these fields, use the ChangeName, SetParent, and Disable methods.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// It is assumed that the caller has the privileges to perform this action
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the current information
   string strResultXml = merchant.Retrieve(userAuth, userAuth.MerchantId, strColumnSetXml);

   // Change the desired data
   XmlDocument oDoc = new XmlDocument();
   oDoc.LoadXml(strResultXml);

   // Update the description. (Add a description if one is not already there)
   XmlNodeList oNodes = oDoc.GetElementsByTagName("description");

   if (oNodes == null || oNodes.Count == 0)
   {
      System.Xml.XmlElement oElement = oDoc.CreateElement("description");
      oElement.InnerText  = "My new business description.";
      oDoc.FirstChild.AppendChild((System.Xml.XmlNode)oElement);
   }
   else
   {
      oNodes.Item(0).InnerText = "My new business description.";
   }

   strResultXml = oDoc.InnerXml;

   // Update the merchant object
   string outXml = merchant.UpdateAndRetrieve(userAuth, userAuth.MerchantId, strResultXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizMerchant Class
  • CreateAndRetrieve
  • Update


BizOrganization Class

The BizOrganization class contains methods that you can use to manage organizations. You must create the Organizational Unit object in Active Directory before you can call these methods. The ID of this Organizational Unit is needed as a parameter to the methods in this class.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  BizOrganization
[Visual Basic .NET]
Public Class BizOrganization
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class BizOrganization : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class BizOrganization: public System.Web.Services.Protocols.SoapHttpClientProtocol

The BizOrganization class exposes the following methods.

Method | Description
Create | Creates an organization.
CreateRootBusiness | Creates a root business unit and the first user in the business unit.
CreateUser | Creates a user in the business unit that is specified in the user XML. The user is assigned the System Administrator role.
Delete | Deletes an organization.
Disable | Disables an organization and all of its business unit hierarchies.
Enable | Enables a previously disabled organization and all of its business unit hierarchies.
Retrieve | Retrieves the XML for an organization.
SetupCreate | For internal use only.
Update | Updates an organization.
UpdateSettings | Updates the settings for an organization.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


BizOrganization.Create Method

The Create method creates an organization. The caller must be a domain administrator to perform this action. You must create the corresponding Organizational Unit object in Active Directory before you can call this method. The ID of this Organizational Unit (OU) is required as a parameter to the methods in this class. The server object must have been granted full permissions on the OU and on the child objects of the OU. Otherwise, Create fails with the error "HTTP: Access denied."

Syntax

[Visual Basic .NET]
Public Sub Create(
  ByVal OrganizationXML As String,
  ByVal OrganizationOU As String
)
[C#]
public void Create(
  string  OrganizationXML,
  string  OrganizationOU
);
[C++]
public: void Create(
  String*  OrganizationXML
  String*  OrganizationOU
);

Parameters

OrganizationXML
Specifies an XML string containing organization information. The XML schema is described by organization.xsd.
OrganizationOU
Specifies the ID of the Organizational Unit object from Active Directory corresponding with the Microsoft CRM organization object.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

Note The following example contains sample data for the administrator login name and password. This is for illustration only. User credentials should never be hard-coded. For more information, see "Building Secure ASP.NET Applications" at msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch12.asp.

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizOrganization proxy object
Microsoft.Crm.Platform.Proxy.BizOrganization organization = new Microsoft.Crm.Platform.Proxy.BizOrganization ();
organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
organization.Url = strDir + "BizOrganization.srf";

string strOrgXML = "";
string strOrgName = "Wingtip Toys";

// Get the GUID of an OU from Active Directory
// that is going to represent the OU for the Microsoft CRM organization object
// The name of the OU should be the same as the name of the Microsoft CRM organization
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

// See Note above regarding the use of hard-coded passwords
string strDomainAdminUserName = "Administrator";
string strDomainAdminUserPass = "Admin";
string strDomainName = "MyDomain";

string strErrorMsg = "";

try
{
   // Set up the XML string for the organization
   strOrgXML = "<organization>" +
      "<name>" + strOrgName + "</name>" +
      "</organization>";

   // Set the credentials of organization proxy with
   // credentials of a user that has domain administrator rights
   organization.Credentials = new System.Net.NetworkCredential(strDomainAdminUserName, strDomainAdminUserPass, strDomainName);

   // Create the organization
   organization.Create(strOrgXML, strOrgId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}
finally
{
   // Set the credentials back to the default
   organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizOrganization Class
  • CreateRootBusiness
  • CreateUser


BizOrganization.CreateRootBusiness Method

The CreateRootBusiness method creates a root business unit and also the first user in the business unit. The user is assigned the System Administrator role. The caller must be a domain administrator to perform this action.

Syntax

[Visual Basic .NET]
Public Function CreateRootBusiness(
  ByVal OrganizationId As String,
  ByVal BusinessXML As String,
  ByVal UserXML As String
) As CBusinessResult
[C#]
public CBusinessResult CreateRootBusiness(
  string  OrganizationId,
  string  BusinessXML,
  string  UserXML
);
[C++]
public: CBusinessResult* CreateRootBusiness(
  String*  OrganizationId,
  String*  BusinessXML,
  String*  UserXML
);

Parameters

OrganizationId
Specifies the ID of the organization in which to create the root business unit. This ID is obtained when you create the Organizational Unit in Active Directory.
BusinessXml
Specifies an XML string containing the business information. The XML schema is described by businessunit.xsd.
UserXml
Specifies an XML string containing the user information. The XML schema is described by systemuser.xsd.

Return Value

Returns a String type that specifies a structure containing the newly created business unit ID and the user ID. See CBusinessResult.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

Note The following example contains sample data for the administrator login name and password. This is for illustration only. User credentials should never be hard-coded. For more information, see "Building Secure ASP.NET Applications" at msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch12.asp.

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizOrganization proxy object
Microsoft.Crm.Platform.Proxy.BizOrganization organization = new Microsoft.Crm.Platform.Proxy.BizOrganization ();
organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
organization.Url = strDir + "BizOrganization.srf";

string strRootBizXML = "";
string strFirstUserXML = "";

// Get the GUID of an OU from Active Directory
// that is going to represent the OU for the Microsoft CRM organization object
// The name of the OU should be the same as the name of the Microsoft CRM organization
// The organization is created in Microsoft CRM
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

// See Note above regarding the use of hard-coded passwords
string strDomainAdminUserName = "Administrator";
string strDomainAdminUserPass = "Admin";
string strDomainName = "MyDomain";

Microsoft.Crm.Platform.Proxy.CBusinessResult BizResult = new Microsoft.Crm.Platform.Proxy.CBusinessResult ();

string strErrorMsg = "";

try
{
   // Set up the XML string for the business unit
   strRootBizXML = "<businessunit>" +
                  "<name>Northwind Traders</name>" +
               "</businessunit>";

   strFirstUserXML = "<systemuser>" +
                     "<firstname>Robert</firstname>" +
                     "<lastname>Zare</lastname>" +
                     "<domainname>DomainName</domainname>" +
                  "</systemuser>";

   // Set the credentials of organization proxy with
   // credentials of a user that has domain administrator rights
   organization.Credentials = new System.Net.NetworkCredential(   strDomainAdminUserName, strDomainAdminUserPass, strDomainName);

   // Before calling this API make sure that
   // First user is created in Active Directory
   BizResult = organization.CreateRootBusiness(strOrgId, strRootBizXML, strFirstUserXML);
   // The user created here is going to be assigned the role of System Administrator
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}
finally
{
   // Set the credentials back to the default
   organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizOrganization Class
  • Create
  • CreateUser


BizOrganization.CreateUser Method

The CreateUser method creates a user in the business unit that is specified in the user XML data. The user is assigned the role of System Administrator. The caller must be a domain administrator to perform this action.

Syntax

[Visual Basic .NET]
Public Function CreateUser(
  ByVal UserXml As String
) As String
[C#]
public string CreateUser(
  string  UserXml
);
[C++]
public: String* CreateUser(
  String*  UserXml
);

Parameters

UserXml
Specifies an XML string containing the user information. The XML schema is described by systemuser.xsd.

Return Value

Returns a String type that specifies the ID of the newly created user.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

Note The following example contains sample data for the administrator login name and password. This is for illustration only. User credentials should never be hard-coded. For more information, see "Building Secure ASP.NET Applications" at msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch12.asp.

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizOrganization proxy object
Microsoft.Crm.Platform.Proxy.BizOrganization organization = new Microsoft.Crm.Platform.Proxy.BizOrganization ();
organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
organization.Url = strDir + "BizOrganization.srf";

string strUserXML = "";
string strOrgName = "Wingtip Toys";

// Get the GUID of an OU from Active Directory
// that is going to represent the OU for the Microsoft CRM organization object
// The name of the OU should be the same as the name of the Microsoft CRM organization
// The organization is created in Microsoft CRM
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

// See Note above regarding the use of hard-coded passwords
string strDomainAdminUserName = "Administrator";
string strDomainAdminUserPass = "Admin";
string strDomainName = "MyDomain";

// A business unit ID where the user is to be created
string strBizId = "{10594FB4-EDE7-4A4A-81E9-E165DEB34756}";
string strUserId = "";
string strErrorMsg = "";

try
{
   strUserXML ="<systemuser>" +
            "<firstname>Ken</firstname>" +
            "<lastname>Sanchez</lastname>" +
            "<domainname>DomainName</domainname>" +
            "<businessunitid>" + strBizId + "</businessunitid>" +
            "</systemuser>";

   // Set the credentials of the organization proxy with
   // the credentials of a user who has domain administrator rights
   organization.Credentials = new System.Net.NetworkCredential(   strDomainAdminUserName,
      strDomainAdminUserPass,
      strDomainName);

   // Create another user with the role of System Administrator
   // in the specified business unit
   strUserId = organization.CreateUser(strUserXML);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}
finally
{
   // Set the credentials back to the default
   organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizOrganization Class
  • Create
  • CreateRootBusiness


BizOrganization.Delete Method

The Delete method deletes an organization. The organization, as well as all its business hierarchies, users, teams, and objects (such as accounts and contacts), are physically deleted from the database. The caller must be a domain administrator to perform this action.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal OrganizationId As String
)
[C#]
public void Delete(
  string  OrganizationId
);
[C++]
public: void Delete(
  String*  OrganizationId
);

Parameters

OrganizationId
Specifies the ID of the organization. This ID is obtained when you create the Organizational Unit in Active Directory.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

Note The following example contains sample data for the administrator login name and password. This is for illustration only. User credentials should never be hard-coded. For more information, see "Building Secure ASP.NET Applications" at msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch12.asp.

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizOrganization proxy object
Microsoft.Crm.Platform.Proxy.BizOrganization organization = new Microsoft.Crm.Platform.Proxy.BizOrganization ();
organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
organization.Url = strDir + "BizOrganization.srf";

string strOrgXML = "";
string strOrgName = "Wingtip Toys";

// Get the GUID of an OU from Active Directory
// that is going to represent the OU for the Microsoft CRM organization object
// The name of the OU should be the same as the name of the Microsoft CRM organization
// The organization is created in Microsoft CRM
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

// See Note above regarding the use of hard-coded passwords
string strDomainAdminUserName = "Administrator";
string strDomainAdminUserPass = "Admin";
string strDomainName = "MyDomain";

string strErrorMsg = "";

try
{

   // Set the credentials of organization proxy with
   // credentials of a user that has domain administrator rights
   organization.Credentials = new System.Net.NetworkCredential(   strDomainAdminUserName,
      strDomainAdminUserPass,
      strDomainName);

      // Delete the organization
      oOrganization.Delete(strOrgId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}
finally
{
   // Set the credentials back to the default
   organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizOrganization Class


BizOrganization.Disable Method

The Disable method disables an organization and all of its business unit hierarchies. No user in the organization can log on to the Microsoft CRM service after the organization is disabled. The caller must be a domain administrator to perform this action.

Syntax

[Visual Basic .NET]
Public Sub Disable(
  ByVal OrganizationId As String,
  ByVal Reason As String
)
[C#]
public void Disable(
  string  OrganizationId,
  string  Reason
);
[C++]
public: void Disable(
  String*  OrganizationId,
  String*  Reason
);

Parameters

OrganizationId
Specifies the ID of the organization. This ID is obtained when you create the Organizational Unit in Active Directory.
Reason
Specifies the reason for disabling the organization.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

Note The following example contains sample data for the administrator login name and password. This is for illustration only. User credentials should never be hard-coded. For more information, see "Building Secure ASP.NET Applications" at msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch12.asp.

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizOrganization proxy object
Microsoft.Crm.Platform.Proxy.BizOrganization organization = new Microsoft.Crm.Platform.Proxy.BizOrganization ();
organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
organization.Url = strDir + "BizOrganization.srf";

string strOrgXML = "";
string strOrgName = "Wingtip Toys";

// Get the GUID of an OU from Active Directory
// that is going to represent the OU for the Microsoft CRM organization object
// The name of the OU should be the same as the name of the Microsoft CRM organization
// The organization is created in Microsoft CRM
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

// See Note above regarding the use of hard-coded passwords
string strDomainAdminUserName = "Administrator";
string strDomainAdminUserPass = "Admin";
string strDomainName = "MyDomain";

string strReason = "Reason to disable the organization.";

string strErrorMsg = "";

try
{

   // Set the credentials of organization proxy with
   // credentials of a user that has domain administrator rights
   organization.Credentials = new System.Net.NetworkCredential(   strDomainAdminUserName,
      strDomainAdminUserPass,
      strDomainName);

   // Disable the organization
   organization.Disable(strOrgId, strReason);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}
finally
{
   // Set the credentials back to the default
   organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizOrganization Class
  • Enable


BizOrganization.Enable Method

The Enable method enables a previously disabled organization and all of its business unit hierarchies. The caller must be a domain administrator to perform this action.

Note Previously disabled hierarchies are enabled as well. The users in the organization whose user records are not specifically disabled will be able to log on to the Microsoft CRM service again.

Syntax

[Visual Basic .NET]
Public Sub Enable(
  ByVal OrganizationId As String
)
[C#]
public void Enable(
  string  OrganizationId
);
[C++]
public: void Enable(
  String*  OrganizationId
);

Parameters

OrganizationId
Specifies the ID of the organization. This ID is obtained when you create the Organizational Unit in Active Directory.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

Note The following example contains sample data for the administrator login name and password. This is for illustration only. User credentials should never be hard-coded. For more information, see "Building Secure ASP.NET Applications" at msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch12.asp.

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizOrganization proxy object
Microsoft.Crm.Platform.Proxy.BizOrganization organization = new Microsoft.Crm.Platform.Proxy.BizOrganization ();
organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
organization.Url = strDir + "BizOrganization.srf";

string strOrgXML = "";
string strOrgName = "Wingtip Toys";

// Get the GUID of an OU from Active Directory
// that is going to represent the OU for the Microsoft CRM organization object
// The name of the OU should be the same as the name of the Microsoft CRM organization
// The organization is created in Microsoft CRM
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

// See Note above regarding the use of hard-coded passwords
string strDomainAdminUserName = "Administrator";
string strDomainAdminUserPass = "Admin";
string strDomainName = "MyDomain";

string strErrorMsg = "";

try
{

   // Set the credentials of organization proxy with
   // credentials of a user that has domain administrator rights
   organization.Credentials = new System.Net.NetworkCredential(   strDomainAdminUserName,
      strDomainAdminUserPass,
      strDomainName);

   // Enable a disabled organization
   organization.Enable(strOrgId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}
finally
{
   // Set the credentials back to the default
   organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizOrganization Class
  • Disable


BizOrganization.Retrieve Method

The Retrieve method retrieves the XML data for an organization.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal OrganizationId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string Retrieve(
  string  OrganizationId,
  string  ColumnSet
);
[C++]
public: String* Retrieve(
  String*  OrganizationId,
  String*  ColumnSet
);

Parameters

OrganizationId
Specifies the ID of the organization. This ID is obtained when you create the Organizational Unit in Active Directory.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in organization.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the organization. The XML schema is described by organization.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

Note The following example contains sample data for the administrator login name and password. This is for illustration only. User credentials should never be hard-coded. For more information, see "Building Secure ASP.NET Applications" at msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch12.asp.

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizOrganization proxy object
Microsoft.Crm.Platform.Proxy.BizOrganization organization = new Microsoft.Crm.Platform.Proxy.BizOrganization ();
organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
organization.Url = strDir + "BizOrganization.srf";

string strOrgXML = "";
string strOrgName = "MyOrganization";

// Get the GUID of an OU from Active Directory
// that is going to represent the OU for the Microsoft CRM organization object
// The name of the OU should be the same as the name of the Microsoft CRM organization
// The organization is created in Microsoft CRM
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

// See Note above regarding the use of hard-coded passwords
string strDomainAdminUserName = "Administrator";
string strDomainAdminUserPass = "Admin";
string strDomainName = "MyDomain";

string strErrorMsg = "";
string strRetrievedOrgXML = "";

try
{
   // Retrieve the organization
   strRetrievedOrgXML = organization.Retrieve(strOrgId, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizOrganization Class


BizOrganization.Update Method

The Update method updates an organization. The caller must be a domain administrator to perform this action.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal OrganizationId As String,
  ByVal OrganizationXml As String
)
[C#]
public void Update(
  string  OrganizationId,
  string  OrganizationXml
);
[C++]
public: void Update(
  String*  OrganizationId,
  String*  OrganizationXml
);

Parameters

OrganizationId
Specifies the ID of the organization. This ID is obtained when you create the Organizational Unit in Active Directory.
OrganizationXml
Specifies an XML string containing the organization information. The XML schema is described by organization.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

Note The following example contains sample data for the administrator login name and password. This is for illustration only. User credentials should never be hard-coded. For more information, see "Building Secure ASP.NET Applications" at msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch12.asp.

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizOrganization proxy object
Microsoft.Crm.Platform.Proxy.BizOrganization organization = new Microsoft.Crm.Platform.Proxy.BizOrganization ();
organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
organization.Url = strDir + "BizOrganization.srf";

string strOrgUpdateXML = "";
string strOrgName = "Wingtip Toys";

// Get the GUID of an OU from Active Directory
// that is going to represent the OU for the Microsoft CRM organization object
// The name of the OU should be the same as the name of the Microsoft CRM organization
// The organization is created in Microsoft CRM
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

// See Note above regarding the use of hard-coded passwords
string strDomainAdminUserName = "Administrator";
string strDomainAdminUserPass = "Admin";
string strDomainName = "MyDomain";

string strErrorMsg = "";

try
{
   strOrgUpdateXML = "<organization>" +
      "<name>Tailspin Toys</name>" +
      "</organization>";

   // Set the credentials of organization proxy with
   // credentials of a user that has domain administrator rights
   organization.Credentials = new System.Net.NetworkCredential(   strDomainAdminUserName,
      strDomainAdminUserPass,
      strDomainName);

   // Update an organization
   organization.Update(strOrgId, strOrgUpdateXML);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}
finally
{
   // Set the credentials back to the default
   organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizOrganization Class


BizOrganization.UpdateSettings Method

The UpdateSettings method updates the settings for an organization.

Syntax

[Visual Basic .NET]
Public Sub UpdateSettings(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal OrganizationXml As String
)
[C#]
public void UpdateSettings(
  CUserAuth  Caller,
  string  OrganizationId,
  string  OrganizationXml
);
[C++]
public: void UpdateSettings(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  OrganizationXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteOrganization privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization. This ID is obtained when you create the Organizational Unit in Active Directory.
OrganizationXml
Specifies an XML string containing the organization information. The XML schema is described by organization.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

Note The following example contains sample data for the administrator login name and password. This is for illustration only. User credentials should never be hard-coded. For more information, see "Building Secure ASP.NET Applications" at msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch12.asp.

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// BizOrganization proxy object
Microsoft.Crm.Platform.Proxy.BizOrganization organization = new Microsoft.Crm.Platform.Proxy.BizOrganization ();
organization.Credentials = System.Net.CredentialCache.DefaultCredentials;
organization.Url = strDir + "BizOrganization.srf";

string strOrgUpdateXML = "";
string strOrgName = "Wingtip Toys";

// Get the GUID of an OU from Active Directory
// that is going to represent the OU for the Microsoft CRM organization object
// The name of the OU should be the same as the name of the Microsoft CRM organization
// The organization is created in Microsoft CRM
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

// See Note above regarding the use of hard-coded passwords
string strDomainAdminUserName = "Administrator";
string strDomainAdminUserPass = "Admin";
string strDomainName = "MyDomain";

string strErrorMsg = "";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set the XML string for the update
   strOrgUpdateXML = "<organization>" +
                     "<caseprefix>CasePrefix</caseprefix>" +
                     "<contractprefix>ContractPrefix</contractprefix>" +
                     "<currentcasenumber>CurrentCaseNumber</currentcasenumber>" +
                     "<currentcontractnumber>CurrentContractNumber</currentcontractnumber>" +
                     "<fiscalperiodtype>FiscalPeriodType</fiscalperiodtype>" +
                  "</organization>";

   // Update settings for the organization
   organization.UpdateSettings(userAuth, strOrgId, strOrgUpdateXML);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizOrganization Class


BizPrivilege Class

The BizPrivilege class contains methods that you can use to manage privileges for an organization.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  BizPrivilege
[Visual Basic .NET]
Public Class BizPrivilege
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class BizPrivilege : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class BizPrivilege: public System.Web.Services.Protocols.SoapHttpClientProtocol

The BizPrivilege class exposes the following methods:

Method | Description
RetrievePrivilegeSet | Retrieves all the privileges defined in the deployment.
RetrieveUserPrivileges | Retrieves all the privileges a user has through his or her roles in the specified business unit.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


BizPrivilege.RetrievePrivilegeSet Method

The RetrievePrivilegeSet method retrieves all the privileges defined in the deployment.

Syntax

[Visual Basic .NET]
Public Function RetrievePrivilegeSet(
  ByVal Caller As CUserAuth
) As String
[C#]
public string RetrievePrivilegeSet(
  CUserAuth  Caller
);
[C++]
public: String* RetrievePrivilegeSet(
  CUserAuth*  Caller
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.

Return Value

Returns a String type that specifies the XML data containing the set of privileges retrieved. This XML string is in the format

<privileges> + privilege1..N + </privileges>

where the XML schema for each privilege is described by privilege.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory   = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser oUser   = new Microsoft.Crm.Platform.Proxy.BizUser ();
oUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
oUser.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.BizPrivilege privilege   = new Microsoft.Crm.Platform.Proxy.BizPrivilege ();
privilege.Credentials = System.Net.CredentialCache.DefaultCredentials;
privilege.Url = strDir + "BizPrivilege.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg = "";
string strPrivilegeSet;
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = oUser.WhoAmI();

   // Retrieve all the privileges
   strPrivilegeSet = privilege.RetrievePrivilegeSet(userAuth);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizPrivilege Class


BizPrivilege.RetrieveUserPrivileges Method

The RetrieveUserPrivileges method retrieves all the privileges a user has through his or her roles in the specified business unit.

Syntax

[Visual Basic .NET]
Public Function RetrieveUserPrivileges(
  ByVal Caller As CUserAuth,
  ByVal UserId As String
) As CRolePrivilege()
[C#]
public CRolePrivilege[] RetrieveUserPrivileges(
  CUserAuth  Caller,
  string  UserId
);
[C++]
public: CRolePrivilege* RetrieveUserPrivileges(
  CUserAuth*  Caller,
  String*  UserId
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
UserId
Specifies the ID of the user whose privileges you want to retrieve.

Return Value

Returns a CRolePrivilege[] type that specifies the privileges that the user holds. See CRolePrivilege.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser oUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
oUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
oUser.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.BizPrivilege privilege   = new Microsoft.Crm.Platform.Proxy.BizPrivilege ();
privilege.Credentials = System.Net.CredentialCache.DefaultCredentials;
privilege.Url = strDir + "BizPrivilege.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg = "";
Microsoft.Crm.Platform.Proxy.CRolePrivilege [] rolePrivResult = null;
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = oUser.WhoAmI();

   // Retrieve all privileges of the caller user
   rolePrivResult = privilege.RetrieveUserPrivileges(userAuth, userAuth.UserId);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizPrivilege Class


BizTeam Class

The BizTeam class contains methods that you can use to manage teams.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  BizTeam
[Visual Basic .NET]
Public Class BizTeam
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class BizTeam : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class BizTeam: public System.Web.Services.Protocols.SoapHttpClientProtocol

The BizTeam class exposes the following methods.

Method | Description
AddMembers | Adds members to a team.
ChangeName | Changes team name.
Create | Creates a new team.
CreateAndRetrieve | Creates a new team, and then retrieves it.
ReassignObjects | Reassigns all objects owned by the team.
ReassignObjectsAndDelete | Not supported in this version.
RemoveMembers | Removes members from a team.
Retrieve | Retrieves team information.
RetrieveMembers | Retrieves the members of a team.
RetrieveParent | Retrieves the parent business unit of a team.
SetParent | Sets the parent business unit of a team
Update | Updates team information.
UpdateAndRetrieve | Updates team information, and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


BizTeam.AddMembers Method

The AddMembers method adds members to a team.

Syntax

[Visual Basic .NET]
Public Sub AddMembers(
  ByVal Caller As CUserAuth,
  ByVal TeamId As String,
  ByVal Members As String()
)
[C#]
public void AddMembers(
  CUserAuth  Caller,
  string  TeamId,
  string[]  Members
);
[C++]
public: void AddMembers(
  CUserAuth*  Caller,
  String*  TeamId,
  String*  Members __gc[]
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteTeam privilege to perform this action. See CUserAuth.
TeamId
Specifies the ID of the team.
Members
Specifies an array of IDs of the users to be added to the team.

Return Value

No return value.

Remarks

If any member in the member list already exists on the team, this method does not return an error.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
string strTeamId = "{GCF99EF1-67IO-4E06-ABD9-EBFE526BF9FF}";
string strUserId1 = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strUserId2 = "{AC82B545-FD28-4F77-BF25-7D34985F3E6D}";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Add users to our member array
   string[] members = new string[2];
   members[0] = strUserId1;
   members[1] = strUserId2;

   // Add members to the team
   team.AddMembers(userAuth, strTeamID, members);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizTeam Class
  • RemoveMembers


BizTeam.ChangeName Method

The ChangeName method changes the name of a team.

Syntax

[Visual Basic .NET]
Public Sub ChangeName(
  ByVal Caller As CUserAuth,
  ByVal TeamId As String,
  ByVal NewName As String
)
[C#]
public void ChangeName(
  CUserAuth  Caller,
  string  TeamId,
  string  NewName
);
[C++]
public: void ChangeName(
  CUserAuth*  Caller,
  String*  TeamId,
  String*  NewName
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteTeam privilege to perform this action. See CUserAuth.
TeamId
Specifies the ID of the team.
NewName
Specifies a new name for the team.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
string strTeamID = "{GCF99EF1-67IO-4E06-ABD9-EBFE526BF9FF}";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   team.ChangeName(userAuth, strTeamID, "The Yellow Team");
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizTeam Class


BizTeam.Create Method

The Create method creates a new team.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal TeamXML As String,
  ByVal Members As String()
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  TeamXML,
  string[]  Members
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  TeamXML,
  String*  Members __gc[]
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateTeam privilege to perform this action. See CUserAuth.
TeamXML
Specifies an XML string containing team information. The XML schema is described by team.xsd.
Members
Specifies an array of user IDs of the initial set of members for the team.

Return Value

Returns a String type that specifies the ID of the newly created team.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Build a team XML string in the business unit of the caller
   string strTeamXML = "<team>";
   strTeamXML += "<name>My Team</name>";
   strTeamXML += "<businessunitid>" + userAuth.MerchantId + "</businessunitid>";
   strTeamXML += "<emailaddress>myteam@northwindtraders.com</emailaddress></team>";

   string[] members = new string[1];
   members[0] = userAuth.UserId;

   // Create a team. This returns the ID of the new team
   string strTeamID = team.Create(userAuth, strTeamXML, members);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizTeam Class
  • CreateAndRetrieve
  • Update


BizTeam.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new team and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal TeamXML As String,
  ByVal Members As String()
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  TeamXML,
  string[]  Members
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  TeamXML,
  String*  Members __gc[]
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateTeam and prvReadTeam privileges to perform this action. See CUserAuth.
TeamXML
Specifies an XML string containing the team information. The XML schema is described by team.xsd.
Members
Specifies an array of user IDs for the initial set of members for the team.

Return Value

Returns a String type that specifies the XML data containing the newly created team information. The XML schema is described by team.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Build a team XML string in the business unit of the caller
   string strTeamXML = "<team>";
   strTeamXML += "<name>Another Team</name>";
   strTeamXML += "<businessunitid>" + userAuth.MerchantId + "</businessunitid>";
   strTeamXML += "<emailaddress>anotherteam@northwindtraders.com</emailaddress></team>";

   string[] members = new string[1];
   members[0] = userAuth.UserId;

   // Create and then retrieve the new team
   string strNewTeamXml = team.CreateAndRetrieve(userAuth, strTeamXML, members);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizTeam Class
  • Create
  • UpdateAndRetrieve


BizTeam.ReassignObjects Method

The ReassignObjects method reassigns all the objects owned by the team to another security principal (user or team). For more information, see the following Remarks.

Syntax

[Visual Basic .NET]
Public Sub ReassignObjects(
  ByVal Caller As CUserAuth,
  ByVal TeamId As String,
  ByVal ReassignId As CSecurityPrincipal
)
[C#]
public void ReassignObjects(
  CUserAuth  Caller,
  string  TeamId,
  CSecurityPrincipal  ReassignId
);
[C++]
public: void ReassignObjects(
  CUserAuth*  Caller,
  String*  TeamId,
  CSecurityPrincipal*  ReassignId
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
TeamId
Specifies the ID of the team.
ReassignId
Specifies the security principal that will take ownership of all objects owned by the team. See CSecurityPrincipal.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not support business-object assignments to teams. Therefore, any solutions built by using this method are not supported by the Microsoft CRM application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
string strTeamID = "{GCF99EF1-67IO-4E06-ABD9-EBFE526BF9FF}";
string strAnotherTeamID = "{F9920C07-EE2A-4616-A7EC-1E9D280CF535}";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Create a new security principal for a different team
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strAnotherTeamID;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptTeam;

   // Now reassign all the objects for that team
   team.ReassignObjects(userAuth, strTeamID, securityPrincipal);
   // Now all of the team objects are owned by strAnotherTeamID

}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizTeam Class


BizTeam.RemoveMembers Method

The RemoveMembers method removes members from a team.

Syntax

[Visual Basic .NET]
Public Sub RemoveMembers(
  ByVal Caller As CUserAuth,
  ByVal TeamId As String,
  ByVal Members As String()
)
[C#]
public void RemoveMembers(
  CUserAuth  Caller,
  string  TeamId,
  string[]  Members
);
[C++]
public: void RemoveMembers(
  CUserAuth*  Caller,
  String*  TeamId,
  String*  Members __gc[]
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteTeam privilege to perform this action. See CUserAuth.
TeamId
Specifies the ID of the team.
Members
Specifies the IDs of the users to remove.

Return Value

No return value.

Remarks

If any member in the member list does not exist on the team, this API does not return an error.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
string strUserID1 = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strUserID2 = "{AC82B545-FD28-4F77-BF25-7D34985F3E6D}";
string strTeamID = "{GCF99EF1-67IO-4E06-ABD9-EBFE526BF9FF}";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   string[] members = new string[2];
   members[0] = strUserID1;
   members[1] = strUserID2;

   // Remove these users from the team
   team.RemoveMembers(userAuth, strTeamID, members);

}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • AddMembers
  • BizTeam Class


BizTeam.Retrieve Method

The Retrieve method retrieves team information.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal TeamId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  TeamId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  TeamId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadTeam privilege to perform this action. See CUserAuth.
TeamId
Specifies the ID of the team to retrieve.
ColumnSetXML
Specifies an XML string describing the fields you would like returned for each member. Passing "" or null returns all columns. The XML schema is described by systemusers.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the team information. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by team.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
string strTeamID = "{GCF99EF1-67IO-4E06-ABD9-EBFE526BF9FF}";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>teamid</column>";
   strColumnSetXml += "<column>emailaddress</column>";
   strColumnSetXml += "</columnset>";

   string strTeamXml = team.Retrieve(userAuth, strTeamID, strColumnSetXml);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizTeam Class
  • RetrieveMembers
  • RetrieveParent


BizTeam.RetrieveMembers Method

The RetrieveMembers method retrieves the members of a team.

Syntax

[Visual Basic .NET]
Public Function RetrieveMembers(
  ByVal Caller As CUserAuth,
  ByVal TeamId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveMembers(
  CUserAuth  Caller,
  string  TeamId,
  string  ColumnSet
);
[C++]
public: String* RetrieveMembers(
  CUserAuth*  Caller,
  String*  TeamId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadTeam privilege to perform this action. See CUserAuth.
TeamId
Specifies the ID of the team.
ColumnSet
Specifies an XML string describing the fields you would like returned for each member. Passing "" or null returns all columns. The XML schema is described by systemusers.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the team member.information The fields that are returned depend on what fields are specified in the ColumnSet. This XML string is in the format

<systemusers> + systemuser1..N + </systemusers>

where the XML schema for each user is described by systemusers.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
string strTeamID = "{GCF99EF1-67IO-4E06-ABD9-EBFE526BF9FF}";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>systemuserid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the members for the team
   string strUsers = team.RetrieveMembers(userAuth, strTeamID, strColumnSetXml);

}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizTeam Class
  • Retrieve


BizTeam.RetrieveParent Method

The RetrieveParent method retrieves the parent business unit of a team.

Syntax

[Visual Basic .NET]
Public Function RetrieveParent(
  ByVal Caller As CUserAuth,
  ByVal TeamId As String
) As String
[C#]
public string RetrieveParent(
  CUserAuth  Caller,
  string  TeamId
);
[C++]
public: String* RetrieveParent(
  CUserAuth*  Caller,
  String*  TeamId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadTeam privilege to perform this action. See CUserAuth.
TeamId
Specifies the ID of the team.

Return Value

Returns a String type that specifies the XML data containing the parent business information. The XML schema is described by businessunit.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
string strTeamID = "{GCF99EF1-67IO-4E06-ABD9-EBFE526BF9FF}";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Retrieve the parent business unit for the team
   string strBusinessId = team.RetrieveParent(userAuth, strTeamID);

}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizTeam Class
  • Retrieve


BizTeam.SetParent Method

The SetParent method sets the parent business unit of a team.

Syntax

[Visual Basic .NET]
Public Sub SetParent(
  ByVal Caller As CUserAuth,
  ByVal TeamId As String,
  ByVal BusinessId As String
)
[C#]
public void SetParent(
  CUserAuth  Caller,
  string  TeamId,
  string  BusinessId
);
[C++]
public: void SetParent(
  CUserAuth*  Caller,
  String*  TeamId,
  String*  BusinessId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReparentTeam privilege to perform this action. See CUserAuth.
TeamId
Specifies the ID of the team.
BusinessId
Specifies the ID of the business unit to which to move the team.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
string strTeamID = "{GCF99EF1-67IO-4E06-ABD9-EBFE526BF9FF}";
string strBizID = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Assign the team to another business unit
   team.SetParent(userAuth, strTeamID, strBizID);

}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizTeam Class


BizTeam.Update Method

The Update method updates team information.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal TeamId As String,
  ByVal TeamXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  TeamId,
  string  TeamXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  TeamId,
  String*  TeamXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteTeam privilege to perform this action. See CUserAuth.
TeamId
Specifies the ID of the team to update.
TeamXML
Specifies an XML string describing the new information for the team. The XML schema is described by team.xsd.

Return Value

No return value.

Remarks

The following fields cannot be updated using this method: Name and BusinessUnitId. Instead, use the ChangeName and SetParent methods for updating these fields.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
string strTeamID = "{GCF99EF1-67IO-4E06-ABD9-EBFE526BF9FF}";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Change some information in the XML string for the team
   string strTeamXML = "<team><emailaddress>salesteam@northwindtraders.com</emailaddress></team>";

   // Update the team
   team.Update(userAuth, strTeamID, strTeamXML);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizTeam Class
  • Create
  • UpdateAndRetrieve


BizTeam.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates team information and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal TeamId As String,
  ByVal InTeamXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  TeamId,
  string  InTeamXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  TeamId,
  String*  InTeamXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteTeam and prvReadTeam privileges to perform this action. See CUserAuth.
TeamId
Specifies the ID of the team to update.
InTeamXML
Specifies an XML string containing the new information for the team. The XML schema is described by team.xsd.

Return Value

Returns a String type that specifies the XML data containing the updated team information. The XML schema is described by team.xsd.

Remarks

The following fields cannot be updated using this method: Name and BusinessUnitId. Instead, use the ChangeName and SetParent methods to update these fields.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// BizTeam proxy object
Microsoft.Crm.Platform.Proxy.BizTeam team = new Microsoft.Crm.Platform.Proxy.BizTeam ();
team.Credentials = System.Net.CredentialCache.DefaultCredentials;
team.Url = strDir + "BizTeam.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
string strTeamID = "{GCF99EF1-67IO-4E06-ABD9-EBFE526BF9FF}";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Change some information in the XML string for the team
   string strTeamXML = "<team><emailaddress>supportteam@northwindtraders.com</emailaddress></team>";

   // Update and then retrieve the team
   string strUpdatedTeamXML = team.UpdateAndRetrieve(userAuth, strTeamID, strTeamXML);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizTeam Class
  • CreateAndRetrieve
  • Update


BizUser Class

The BizUser class contains methods that you can use to manage users.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  BizUser
[Visual Basic .NET]
Public Class BizUser
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class BizUser : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class BizUser: public System.Web.Services.Protocols.SoapHttpClientProtocol

The BizUser class exposes the following methods.

Method | Description
Create | Creates a user.
CreateAndRetrieve | Creates a user and then retrieves this user.
CreateUserSettings | Creates the user settings for the specified user.
DeleteUserSettings | Deletes the user settings for the specified user.
Disable | Disables a user. The user cannot log on after being disabled.
Enable | Enables a user. The user is able to log on.
ReassignObjects | Reassigns all objects that are owned by the specified user to another team or user.
ReassignObjectsAndDelete | Not supported in this version.
RemoveParent | Removes the parent user for the specified user.
Retrieve | Retrieves user information.
RetrieveAllChildUsers | Retrieves all users in the reporting hierarchy for the specified user.
RetrieveBusiness | Retrieves the business information for the specified user.
RetrieveChildUsers | Retrieves the users that are below the specified user in the hierarchy.
RetrieveParent | Retrieves information about the parent user.
RetrieveTeams | Retrieves the list of teams of which the specified user is a member.
RetrieveUserSettings | Retrieves the user settings for the specified user.
SetBusiness | Moves the user to a different business unit.
SetParent | Sets a new parent user for the specified user.
Update | Updates user information.
UpdateAndRetrieve | Updates user information and then retrieves it.
UpdateUserSettings | Updates the user settings for the specified user.
WhoAmI | Retrieves user information for the logged on user.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


BizUser.Create Method

The Create method creates a user.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal User As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  User
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  User
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateUser privilege to perform this action. See CUserAuth.
User
Specifies an XML string containing the user information. The XML schema is described by systemuser.xsd.

Return Value

Returns a String type that specifies the ID of the newly created user.

Remarks

After the user is created, call the BizSecRole::AssignUserRoles method to assign security roles to the user.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strBizID = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string sUserName = "jpeoples";

   // Set up the XML string for the user
   // The domainname field must map to an existing Active Directory user name
   string strUserXml = "<systemuser><domainname>" + sUserName + "</domainname>";
   strUserXml += "<firstname>John</firstname>";
   strUserXml += "<lastname>Peoples</lastname>";
   strUserXml += "<businessunitid>" + strBizID + "</businessunitid>";
   strUserXml += "</systemuser>";

   string strUserId = bizUser.Create(userAuth, strUserXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • CreateAndRetrieve
  • Update


BizUser.CreateAndRetrieve Method

The CreateAndRetrieve method creates a user and then retrieves the newly created user.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal User As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  User
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  User
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateUser and prvReadUser privileges to perform this action. See CUserAuth.
User
Specifies an XML string containing the user information. The XML schema is described by systemuser.xsd.

Return Value

Returns a String type that specifies the XML data containing the newly created user information. The XML schema is described by systemuser.xsd.

Remarks

After the user is created, call the SecRole.AssignUserRoles method to assign proper security roles to the user.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strBizID = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string sUserName = "jpeoples";

   // Set up the XML string for the user
   // The domainname field must map to an existing Active Directory user name
   string strUserXml = "<systemuser><domainname>" + sUserName + "</domainname>";
   strUserXml += "<firstname>John</firstname>";
   strUserXml += "<lastname>Peoples</lastname>";
   strUserXml += "<businessunitid>" + strBizID + "</businessunitid>";
   strUserXml += "</systemuser>";

   string strNewUserXml = bizUser.CreateAndRetrieve(userAuth, strUserXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • Create
  • UpdateAndRetrieve


BizUser.CreateUserSettings Method

The CreateUserSettings method creates the user settings for the specified user.

Syntax

[Visual Basic .NET]
Public Sub CreateUserSettings(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal SettingsXML As String
)
[C#]
public void CreateUserSettings(
  CUserAuth  Caller,
  string  UserId,
  string  SettingsXML
);
[C++]
public: void CreateUserSettings(
  CUserAuth*  Caller,
  String*  UserId,
  String*  SettingsXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateUserSettings privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user.
SettingsXML
Specifies an XML string containing the user settings. The XML schema is described by usersettings.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the user settings
   string strUserSettingsXml = "<usersettings>";
   strUserSettingsXml += "<workplacestyle>1</workplacestyle>";
   strUserSettingsXml += "<businessunitid>" + userAuth.MerchantId + "</businessunitid>";
   strUserSettingsXml += "</usersettings>";

   bizUser.CreateUserSettings(userAuth, strUserId, strUserSettingsXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • Create
  • UpdateUserSettings


BizUser.DeleteUserSettings Method

The DeleteUserSettings method deletes the user settings for the specified user.

Syntax

[Visual Basic .NET]
Public Sub DeleteUserSettings(
  ByVal Caller As CUserAuth,
  ByVal UserId As String
)
[C#]
public void DeleteUserSettings(
  CUserAuth  Caller,
  string  UserId
);
[C++]
public: void DeleteUserSettings(
  CUserAuth*  Caller,
  String*  UserId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteUserSettings privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user whose settings are to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the user settings
   bizUser.DeleteUserSettings(userAuth, strUserID);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class


BizUser.Disable Method

The Disable method disables a user. The user is not able to log on to the system after being disabled.

Syntax

[Visual Basic .NET]
Public Sub Disable(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal Reason As String
)
[C#]
public void Disable(
  CUserAuth  Caller,
  string  UserId,
  string  Reason
);
[C++]
public: void Disable(
  CUserAuth*  Caller,
  String*  UserId,
  String*  Reason
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDisableUser privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.
Reason
Specifies the reason for disabling the user.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Disable the user
   bizUser.Disable(userAuth, strUserID, "A reason for being disabled");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • Enable


BizUser.Enable Method

The Enable method enables a user. The user is able to log on to the system after this call.

Syntax

[Visual Basic .NET]
Public Sub Enable(
  ByVal Caller As CUserAuth,
  ByVal UserId As String
)
[C#]
public void Enable(
  CUserAuth  Caller,
  string  UserId
);
[C++]
public: void Enable(
  CUserAuth*  Caller,
  String*  UserId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDisableUser privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Enable the user
   bizUser.Enable(userAuth, strUserID);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • Disable


BizUser.ReassignObjects Method

The ReassignObjects method reassigns all objects that are owned by the user to another team or user.

Syntax

[Visual Basic .NET]
Public Sub ReassignObjects(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal ReassignId As CSecurityPrincipal
)
[C#]
public void ReassignObjects(
  CUserAuth  Caller,
  string  UserId,
  CSecurityPrincipal  ReassignId
);
[C++]
public: void ReassignObjects(
  CUserAuth*  Caller,
  String*  UserId,
  CSecurityPrincipal*  ReassignId
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.
ReassignId
Specifies the target team or user the user's objects will be assigned to. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strAnotherUserID = "{F9920C07-EE2A-4616-A7EC-1E9D280CF535}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strAnotherUserID;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Reassign the objects to the second user
   bizUser.ReassignObjects(userAuth, strUserID, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class


BizUser.RemoveParent Method

The RemoveParent method removes the parent user for the given user. This does not delete the parent user; it sets the parent user field to null.

Syntax

[Visual Basic .NET]
Public Sub RemoveParent(
  ByVal Caller As CUserAuth,
  ByVal UserId As String
)
[C#]
public void RemoveParent(
  CUserAuth  Caller,
  string  UserId
);
[C++]
public: void RemoveParent(
  CUserAuth*  Caller,
  String*  UserId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReparentUser privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Remove the current parent
   bizUser.RemoveParent(userAuth, strUserID);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • SetParent


BizUser.Retrieve Method

The Retrieve method retrieves user information for the specified user.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  UserId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  UserId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadUser privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.
ColumnSetXml
Specifies an XML string describing the fields you would like returned for each user. Passing "" or null returns all columns. The XML schema is described by systemuser.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the user information. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by systermuser.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>fullname</column>";
   strColumnSetXml += "<column>internalemailaddress</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the information for that user
   string strUserXml = bizUser.Retrieve(userAuth, strUserID, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • RetrieveAllChildUsers
  • RetrieveBusiness
  • RetrieveChildUsers
  • RetrieveParent
  • RetrieveTeams


BizUser.RetrieveAllChildUsers Method

The RetrieveAllChildUsers method retrieves all users in the reporting hierarchy of the specified user.

Syntax

[Visual Basic .NET]
Public Function RetrieveAllChildUsers(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveAllChildUsers(
  CUserAuth  Caller,
  string  UserId,
  string  ColumnSet
);
[C++]
public: String* RetrieveAllChildUsers(
  CUserAuth*  Caller,
  String*  UserId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadUser privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.
ColumnSet
Specifies an XML string describing the fields you would like returned for each user. Passing "" or null returns all columns. The XML schema is described by systemuser.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data listing all users. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<systemusers> + systemuser1..N + </systemusers>

where the XML schema for each user is described by systemuser.xsd.

Remarks

The returned user XML data is not in the hierarchical format. Instead, it is a flat format, as shown in the following example:

User hierarchy:

                         U
                     /         \
                   U1          U2
                  / \          / \
                U11 U12      U21 U22

A call to RetrieveAllChildUsers for user U returns the following XML data:

<systemusers>
   <systemuser>U1 fields</systemuser>
   <systemuser>U2 fields</systemuser>
   <systemuser>U11 fields</systemuser>
   <systemuser>U12 fields</systemuser>
   <systemuser>U21 fields</systemuser>
   <systemuser>U22 fields</systemuser>
</systemusers>

Note This order is not guaranteed unless OrderXml is specified in the ColumnSet parameter. See ColumnSetXML Schema.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>fullname</column>";
   strColumnSetXml += "<column>internalemailaddress</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve all users in the specified user hierarchy
   string strUserXml = bizUser.RetrieveAllChildUsers(userAuth,    strUserID, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • Retrieve


BizUser.RetrieveBusiness Method

The RetrieveBusiness method retrieves the business information for the specified user.

Syntax

[Visual Basic .NET]
Public Function RetrieveBusiness(
  ByVal Caller As CUserAuth,
  ByVal UserId As String
) As String
[C#]
public string RetrieveBusiness(
  CUserAuth  Caller,
  string  UserId
);
[C++]
public: String* RetrieveBusiness(
  CUserAuth*  Caller,
  String*  UserId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadBusinessUnit privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.

Return Value

Returns a String type that specifies the XML data containing the user information. The XML schema is described by businessunit.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the business unit for the specified user
   string strBizXml = bizUser.RetrieveBusiness(userAuth, strUserID);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • Retrieve


BizUser.RetrieveChildUsers Method

The RetrieveChildUsers method retrieves the users that are below the specified user in the hierarchy.

Syntax

[Visual Basic .NET]
Public Function RetrieveChildUsers(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveChildUsers(
  CUserAuth  Caller,
  string  UserId,
  string  ColumnSet
);
[C++]
public: String* RetrieveChildUsers(
  CUserAuth*  Caller,
  String*  UserId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadUser privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.
ColumnSet
Specifies an XML string describing the fields you would like returned for each child user. Passing "" or null returns all columns. The XML schema is described by systemuser.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data listing the child users. The fields that are returned for each child user depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<systemusers> + systemuser1..N + </systemusers>

where the XML schema for each user is described by systemuser.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve child users. A blank string for ColumnSet retrieves every column
   string strChildUsersXml = bizUser.RetrieveChildUsers(userAuth, strUserId, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • Retrieve


BizUser.RetrieveParent Method

The RetrieveParent method retrieves user information about the parent of the specified user.

Syntax

[Visual Basic .NET]
Public Function RetrieveParent(
  ByVal Caller As CUserAuth,
  ByVal UserId As String
) As String
[C#]
public string RetrieveParent(
  CUserAuth  Caller,
  string  UserId
);
[C++]
public: String* RetrieveParent(
  CUserAuth*  Caller,
  String*  UserId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadUser privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.

Return Value

Returns a String type that specifies the XML data containing the parent user information. The XML schema is described by systemuser.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the parent for the specified user
   // This will succeed if the user has a parent user; otherwise, it will fail
   string strParentUserXml = bizUser.RetrieveParent(userAuth, strUserID);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • Retrieve


BizUser.RetrieveTeams Method

The RetrieveTeams method retrieves the list of teams of which the specified user is a member.

Syntax

[Visual Basic .NET]
Public Function RetrieveTeams(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveTeams(
  CUserAuth  Caller,
  string  UserId,
  string  ColumnSet
);
[C++]
public: String* RetrieveTeams(
  CUserAuth*  Caller,
  String*  UserId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadTeam privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.
ColumnSet
Specifies an XML string describing the fields you would like returned for each team. Passing "" or null returns all columns. The XML schema is described by team.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data listing all teams. The fields that are returned for each team depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<teams> + team1..N + </teams>

where the XML schema for each team is described by team.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve all of the teams for the specified user
   string strTeamsXml = bizUser.RetrieveTeams(userAuth, strUserId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • Retrieve


BizUser.RetrieveUserSettings Method

The RetrieveUserSettings method retrieves the user settings for the specified user.

Syntax

[Visual Basic .NET]
Public Function RetrieveUserSettings(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveUserSettings(
  CUserAuth  Caller,
  string  UserId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveUserSettings(
  CUserAuth*  Caller,
  String*  UserId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadUserSettings privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user whose settings are to be retrieved.
ColumnSetXML
Specifies an XML string describing the fields you would like returned for each team. Passing "" or null returns all columns. The XML schema is described by usersettings.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the user settings. The fields that are returned for each team depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by usersettings.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the user settings
// A blank string for ColumnSet retrieves every column
   string strUserSettingsXml = bizUser.RetrieveUserSettings(userAuth, strUserId, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • Retrieve


BizUser.SetBusiness Method

The SetBusiness method moves a user to a different business unit. If the ReassignId value is provided, the objects that had been assigned to the specified user are assigned to that ID value. If any of the user's direct reports are no longer in the new business unit hierarchy after the user is moved, these direct reports are updated to report to the user's previous manager. If the user has been moved out of his or her manager's business unit hierarchy, the user's manager is set to null.

Syntax

[Visual Basic .NET]
Public Sub SetBusiness(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal BusinessId As String,
  ByVal ReassignId As CSecurityPrincipal
)
[C#]
public void SetBusiness(
  CUserAuth  Caller,
  string  UserId,
  string  BusinessId,
  CSecurityPrincipal  ReassignId
);
[C++]
public: void SetBusiness(
  CUserAuth*  Caller,
  String*  UserId,
  String*  BusinessId,
  CSecurityPrincipal*  ReassignId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReparentUser privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.
BusinessId
Specifies the ID of the business unit to which the user is moved. This ID is specified by the platform and obtained at creation time.
ReassignId
Specifies the target team or user to which the objects of the user are to be assigned. If ReassignId is a NULL or an empty string, an error occurs.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strAnotherUserID = "{F9920C07-EE2A-4616-A7EC-1E9D280CF535}";
string strBizID = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new    Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strAnotherUserID;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Reassign the user to the second business
   // All of the objects owned by the user will be assigend to the specified security principal
   bizUser.SetBusiness(userAuth, strUserID, strBizID, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class


BizUser.SetParent Method

The SetParent method sets a new parent user for the specified user. If KeepChildUsers is set to false, all direct reports of the user are updated to report to the user's original manager.

Syntax

[Visual Basic .NET]
Public Sub SetParent(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal ParentId As String,
  ByVal KeepChildUsers As Integer
)
[C#]
public void SetParent(
  CUserAuth  Caller,
  string  UserId,
  string  ParentId,
  int  KeepChildUsers
);
[C++]
public: void SetParent(
  CUserAuth*  Caller,
  String*  UserId,
  String*  ParentId,
  long  KeepChildUsers
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReparentUser privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.
ParentId
Specifies the ID of the new parent user. This ID is specified by the platform and obtained at creation time.
KeepChildUsers
Specifies whether the child users are to be retained. If this flag is true, the child users will still report to this user. If it is false, the child users will be updated to report to the users' original manager.

Return Value

No return value.

Remarks

The user must be in the business unit hierarchy of the new parent user.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strParentUserID = "{F9920C07-EE2A-4616-A7EC-1E9D280CF535}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set the parent
   bizUser.SetParent(userAuth, strUserID, strParentUserID, 1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • RemoveParent


BizUser.Update Method

The Update method updates the information about a user.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal UserXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  UserId,
  string  UserXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  UserId,
  String*  UserXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteUser privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user. This ID is specified by the platform and obtained at creation time.
UserXML
Specifies an XML string containing user information. The XML schema is described by systemuser.xsd.

Return Value

No return value.

Remarks

The following fields cannot be updated using the Update method: BusinessUnitId, ParentSystemUserId, and IsDisabled. Use the SetBusiness, SetParent, and Disable methods to update these fields.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the user
   string strUserXml = "<systemuser><internalemailaddress>john@wintiptoys.com</internalemailaddress></systemuser>";

   // Update the user information
   bizUser.Update(userAuth, strUserId, strUserXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • Create
  • UpdateAndRetrieve


BizUser.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates user information and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal InUserXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  UserId,
  string  InUserXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  UserId,
  String*  InUserXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteUser and prvReadUser privileges to perform this action. See CUserAuth.
UserId
Specifies the ID of the user This ID is specified by the platform and obtained at creation time.
InUserXML
Specifies an XML string containing the user information. The XML schema is described by systemuser.xsd.

Return Value

Returns a String type that specifies the XML data containing the now updated user information. The XML schema is described by systemuser.xsd.

Remarks

The following fields cannot be updated by using the UpdateAndRetrieve method: BusinessUnitId, ParentSystemUserId, and IsDisabled. Use the SetBusiness, SetParent, and Disable methods to update these fields.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the user
   string strUserXml = "<systemuser><internalemailaddress>john@wintiptoys.com</internalemailaddress></systemuser>";

   // Update and then retrieve the user information
   string strNewUserXml = bizUser.UpdateAndRetrieve(userAuth, strUserId, strUserXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • CreateAndRetrieve
  • Update


BizUser.UpdateUserSettings Method

The UpdateUserSettings method updates the user settings for the specified user.

Syntax

[Visual Basic .NET]
Public Sub UpdateUserSettings(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal SettingsXML As String
)
[C#]
public void UpdateUserSettings(
  CUserAuth  Caller,
  string  UserId,
  string  SettingsXML
);
[C++]
public: void UpdateUserSettings(
  CUserAuth*  Caller,
  String*  UserId,
  String*  SettingsXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteUserSettings privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user whose settings are to be updated.
SettingsXML
Specifies an XML string containing the user settings. The XML schema is described by usersettings.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the user settings
   string strUserSettingsXml = "<usersettings><workplacestyle>0</workplacestyle></usersettings>";

   // Update the user settings
   bizUser.UpdateUserSettings(userAuth, strUserId, strUserSettingsXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class
  • CreateUserSettings
  • Update


BizUser.WhoAmI Method

The WhoAmI method retrieves the user information for the logged-on user.

Syntax

[Visual Basic .NET]
Public Function WhoAmI() As CUserAuth
[C#]
public CUserAuth WhoAmI();
[C++]
public: CUserAuth* WhoAmI();

Parameters

This method takes no parameters.

Return Value

Returns a CUserAuth class that specifies the UserId and MerchantId values for the logged-on user. See CUserAuth.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • BizUser Class


CRMAccount Class

The CRMAccount class contains methods that you can use to manage accounts.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMAccount
[Visual Basic .NET]
Public Class CRMAccount
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMAccount : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMAccount: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMAccount class exposes the following methods.

Method | Description
Activate | Sets the state of an account to Active.
AddSubAccount | Adds a sub-account to the specified account.
AddSubContact | Adds a sub-contact to the specified account.
Assign | Assigns the specified account to another security principal.
BulkRetrieve | Retrieves multiple accounts from the database.
Create | Creates a new account.
CreateAndRetrieve | Creates a new account and then retrieves it.
Deactivate | Sets the state of an account to Inactive.
Delete | Deletes an account and its child objects.
GetPrimaryContact | Retrieves the primary contact for the specified account.
GrantAccess | Grants the specified security principal access to an account.
MakePrivate | Makes an account private.
MakePublic | Makes an account public.
ModifyAccess | Replaces the access rights on the account for the specified security principal.
RemoveSubAccount | Removes a sub-account from the specified account.
RemoveSubContact | Removes a sub-contact from the specified account.
Retrieve | Retrieves the account information for the specified account.
RetrieveAllLeads | Retrieves all leads that are children of the account or children of the child contacts of the account.
RetrieveAllOpportunities | Retrieves all opportunities that are children of the account or children of the child contacts of the account.
RetrieveByObject | Retrieves accounts associated with a particular object (lead or opportunity).
RetrieveByPrincipal | Retrieves all the accounts owned by the specified security principal.
RetrievePrincipalAccess | Retrieves the access a security principal has to the specified account.
RetrieveSharedPrincipals | Returns a list of security principals with whom this account is shared.
RetrieveSharedPrincipalsAndAccess | Retrieves all the security principals (users or teams) that have access to the specified account, along with what access they have.
RetrieveSubAccounts | Retrieves the sub-accounts of the specified account.
RetrieveSubContacts | Retrieves the sub-contacts of the specified account.
RetrieveSubLeads | Retrieves the child leads of the specified account.
RetrieveSubOpportunities | Retrieves the child opportunities of the specified account.
RevokeAccess | Revokes access of a security principal to the specified account.
SetPrimaryContact | Sets the primary contact for the specified account.
Update | Updates the specified account record.
UpdateAndRetrieve | Updates the specified account record, and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMAccount.Activate Method

The Activate method sets the state of an account to Active.

Syntax

[Visual Basic .NET]
Public Sub Activate(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal Status As Integer
)
[C#]
public void Activate(
  CUserAuth  Caller,
  string  AccountId,
  int  Status
);
[C++]
public: void Activate(
  CUserAuth*  Caller,
  String*  AccountId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account to activate.
Status
Specifies the status of the account. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Deactivate the account
   account.Deactivate(userAuth, strAccountId, -1);

   // Now activate the account
   account.Activate(userAuth, strAccountId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class


CRMAccount.AddSubAccount Method

The AddSubAccount method adds a sub-account to the specified account.

Syntax

[Visual Basic .NET]
Public Sub AddSubAccount(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal SubAccountId As String
)
[C#]
public void AddSubAccount(
  CUserAuth  Caller,
  string  AccountId,
  string  SubAccountId
);
[C++]
public: void AddSubAccount(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  SubAccountId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendAccount and prvAppendToAccount privileges to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
SubAccountId
Specifies the ID of the sub-account to be added to the account.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";
string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
string strSubAccountId = "{007DD797-5E44-49AE-8D5C-24BD1E2C7541}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Add another account as a sub-account
   account.AddSubAccount(userAuth, strAccountId, strSubAccountId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • RemoveSubAccount


CRMAccount.AddSubContact Method

The AddSubContact method adds a sub-contact to the specified account. This means that the specified contact becomes a child of the specified account.

Syntax

[Visual Basic .NET]
Public Sub AddSubContact(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal SubContactId As String
)
[C#]
public void AddSubContact(
  CUserAuth  Caller,
  string  AccountId,
  string  SubContactId
);
[C++]
public: void AddSubContact(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  SubContactId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendContact and prvAppendToAccount privileges to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
SubContactId
Specifies the ID of the sub-contact to be added to the account.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strContactId = "{5J84E79C-7E9I-324K-HK89-9K86FEJK534C}";
string strAccountId = "{3E24E79K-7EC5-4473-95FF-7E46FELM534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Add contact as a sub-contact
   account.AddSubContact(userAuth, strAccountId, strContactId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • RemoveSubContact


CRMAccount.Assign Method

The Assign method assigns the account to a security principal (user or team). (See Remarks.) This method also applies to the parent object and associated objects that have the same owner as the parent object. Therefore when you assign the parent object to a new owner, only the associated objects that have the same owner as the parent object are assigned. In addition, when an object is assigned to a new owner, it is shared with the previous owner with full rights. Either the new owner or the previous owner can remove the relationship or lower the level of privileges the previous owner had on the object.

Syntax

[Visual Basic .NET]
Public Sub Assign(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal Assignee As CSecurityPrincipal
)
[C#]
public void Assign(
  CUserAuth  Caller,
  string  AccountId,
  CSecurityPrincipal  Assignee
);
[C++]
public: void Assign(
  CUserAuth*  Caller,
  String*  AccountId,
  CSecurityPrincipal*  Assignee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account to be assigned.
Assignee
Specifies the team or user to which the account is to be assigned. See CSecurityPrincipal.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not support business-object assignment to teams. Therefore, any solutions built by using this method are not supported by the Microsoft CRM application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";
string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the account to another security principal
   // Here we are assigning to a user
   account.Assign(userAuth, strAccountId, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class


CRMAccount.BulkRetrieve Method

The BulkRetrieve method retrieves multiple accounts from the database.

Syntax

[Visual Basic .NET]
Public Function BulkRetrieve(
  ByVal Caller As CUserAuth,
  ByVal Ids As String(),
  ByVal ColumnSet As String
) As String
[C#]
public string BulkRetrieve(
  CUserAuth  Caller,
  string[]  Ids,
  string  ColumnSet
);
[C++]
public: String* BulkRetrieve(
  CUserAuth*  Caller,
  String*  Ids __gc[],
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadAccount privilege to perform this action. See CUserAuth.
Ids
Specifies the IDs of the accounts to be retrieved. See Remarks below.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in account.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested account information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<accounts> + account1..N + </accounts>

where the XML schema for each account is described by account.xsd.

Remarks

The array of IDs passed in must not have any empty elements.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strAccountId2 = "{72D46F0C-3855-4CA2-96E9-498E9BA08665}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string[] accounts = new string[2];
   accounts [0] = strAccountId;
   accounts [1] = strAccountId2;

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountnumber</column>";
   strColumnSetXml += "</columnset>";

   string strAccountsXml = account.BulkRetrieve(userAuth, accounts, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class


CRMAccount.Create Method

The Create method creates a new account.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal Account As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  Account
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  Account
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateAccount privilege to perform this action. See CUserAuth.
Account
Specifies an XML string containing the new account information. The XML schema is described by account.xsd.

Return Value

Returns a String type that specifies the ID of the newly created account.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the account
   string strAccountXml = "<account>";
   strAccountXml += "<name>Account Number 1</name>";
   strAccountXml += "<accountnumber>A0192</accountnumber>";
   strAccountXml += "<websiteurl>www.adventure-works.com</websiteurl>";
   strAccountXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strAccountXml += userAuth.UserId + "</ownerid>";
   strAccountXml += "</account>";

   string strAccountId = account.Create(userAuth, strAccountXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMAccount Class
  • Update


CRMAccount.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new account and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InAccountXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InAccountXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InAccountXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateAccount and prvReadAccount privileges to perform this action. See CUserAuth.
InAccountXml
Specifies an XML string containing the new account information. The XML schema is described by account.xsd.

Return Value

Returns a String type that specifies the XML data containing the account information for the newly created account. The XML schema is described by account.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the account
   string strAccountXml = "<account>";
   strAccountXml += "<name>Account Number 2</name>";
   strAccountXml += "<accountnumber>A0193</accountnumber>";
   strAccountXml += "<websiteurl>www.adventure-works.com</websiteurl>";
   strAccountXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strAccountXml += userAuth.UserId + "</ownerid>";
   strAccountXml += "</account>";

   string strNewAccountXml = account.CreateAndRetrieve(userAuth, strAccountXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMAccount Class
  • UpdateAndRetrieve


CRMAccount.Deactivate Method

The Deactivate method sets the state of an account to Inactive.

Syntax

[Visual Basic .NET]
Public Sub Deactivate(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal Status As Integer
)
[C#]
public void Deactivate(
  CUserAuth  Caller,
  string  AccountId,
  int  Status
);
[C++]
public: void Deactivate(
  CUserAuth*  Caller,
  String*  AccountId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account to deactivate.
Status
Specifies the status of the account. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Deactivate the account
   account.Deactivate(userAuth, strAccountId, -1);

   // Now activate the account
   account.Activate(userAuth, strAccountId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class


CRMAccount.Delete Method

The Delete method deletes an account. When Delete is called on an account, all child objects of the account are also deleted. If the caller does not have the DELETE privilege for any of these child objects, then the entire deletion fails.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  AccountId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  AccountId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the account
   account.Delete(userAuth, strAccountId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class


CRMAccount.GetPrimaryContact Method

The GetPrimaryContact method retrieves the primary contact for the specified account.

Syntax

[Visual Basic .NET]
Public Function GetPrimaryContact(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String
) As String
[C#]
public string GetPrimaryContact(
  CUserAuth  Caller,
  string  AccountId
);
[C++]
public: String* GetPrimaryContact(
  CUserAuth*  Caller,
  String*  AccountId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account in which you are interested.

Return Value

Returns a String type that specifies the XML data containing the primary contact. The XML schema is described by contact.xsd.

Remarks

This method fails if the primary contact has not been set.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";
string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the primary contact for the account
   string strResultXml = account.GetPrimaryContact(userAuth, strAccountId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • SetPrimaryContact


CRMAccount.GrantAccess Method

The GrantAccess method grants a user or team access to the specified account. This method also applies to all child objects of the account. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the account. In this case, only the lack of privileges for a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub GrantAccess(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void GrantAccess(
  CUserAuth  Caller,
  string  AccountId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void GrantAccess(
  CUserAuth*  Caller,
  String*  AccountId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account in which you are interested.
Rights
Specifies the set of rights to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or user that will be granted access. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set the rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Grant access to the specified user
   account.GrantAccess(userAuth, strAccountId, rights, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class


CRMAccount.MakePrivate Method

The MakePrivate method makes the account unavailable to anyone except the owner and the users that share the object. Only the owner of an account can make it private. By default, all objects are public. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub MakePrivate(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String
)
[C#]
public void MakePrivate(
  CUserAuth  Caller,
  string  AccountId
);
[C++]
public: void MakePrivate(
  CUserAuth*  Caller,
  String*  AccountId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteAccount privilege and must be the object owner to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account to be made private.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if an object is made private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";
string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make it private
   account.MakePrivate(userAuth, strAccountId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • MakePublic


CRMAccount.MakePublic Method

The MakePublic method makes an account available to all users. Only the owner of an account can make it public. By default, all objects are public. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub MakePublic(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String
)
[C#]
public void MakePublic(
  CUserAuth  Caller,
  string  AccountId
);
[C++]
public: void MakePublic(
  CUserAuth*  Caller,
  String*  AccountId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteAccount privilege and must be the object owner to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account to be made public.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if an object is made private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make it public
   account.MakePublic(userAuth, strAccountId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • MakePrivate


CRMAccount.ModifyAccess Method

The ModifyAccess method replaces the access rights on the account for the specified security principal. This method also applies to all child objects of the account. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the account. In this case, only the lack of privileges to a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub ModifyAccess(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void ModifyAccess(
  CUserAuth  Caller,
  string  AccountId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void ModifyAccess(
  CUserAuth*  Caller,
  String*  AccountId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvShareAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
Rights
Specifies the set of rights to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or user that will be granted access. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set the rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Modify access for the specified user
   account.ModifyAccess(userAuth, strAccountId, rights, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   //Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   //Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class


CRMAccount.RemoveSubAccount Method

The RemoveSubAccount method removes a sub-account from the specified account.

Syntax

[Visual Basic .NET]
Public Sub RemoveSubAccount(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal SubAccountId As String
)
[C#]
public void RemoveSubAccount(
  CUserAuth  Caller,
  string  AccountId,
  string  SubAccountId
);
[C++]
public: void RemoveSubAccount(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  SubAccountId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendAccount and prvAppendToAccount privileges to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
SubAccountId
Specifies the ID of the sub-account to be removed.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
string strSubAccountId = "{007DD797-5E44-49AE-8D5C-24BD1E2C7541}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Remove the sub-account
   account.RemoveSubAccount(userAuth, strAccountId, strSubAccountId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • AddSubAccount
  • CRMAccount Class


CRMAccount.RemoveSubContact Method

The RemoveSubContact method removes a sub-contact from the specified account.

Syntax

[Visual Basic .NET]
Public Sub RemoveSubContact(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal SubContactId As String
)
[C#]
public void RemoveSubContact(
  CUserAuth  Caller,
  string  AccountId,
  string  SubContactId
);
[C++]
public: void RemoveSubContact(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  SubContactId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendContact and prvAppendToAccount privileges to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
SubContactId
Specifies the ID of the sub-contact to be removed.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";
string strErrorMsg;
string strContactId = "{5J84E79C-7E9I-324K-HK89-9K86FEJK534C}";
string strAccountId = "{3E24E79K-7EC5-4473-95FF-7E46FELM534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Remove the sub-contact
   account.RemoveSubContact(userAuth, strAccountId, strContactId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • AddSubContact
  • CRMAccount Class


CRMAccount.Retrieve Method

The Retrieve method retrieves the account information for the specified account.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  AccountId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in account.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested account information. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by account.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79K-7EC5-4473-95FF-7E46FELM534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the account
   string strResultXml = account.Retrieve(userAuth, strAccountId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • RetrieveAllLeads
  • RetrieveAllOpportunities
  • RetrieveByObject
  • RetrieveByPrincipal
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipals
  • RetrieveSharedPrincipalsAndAccess
  • RetrieveSubAccounts
  • RetrieveSubContacts
  • RetrieveSubLeads
  • RetrieveSubOpportunities


CRMAccount.RetrieveAllLeads Method

The RetrieveAllLeads method retrieves all leads that are children of the account or children of the child contacts of the account.

Syntax

[Visual Basic .NET]
Public Function RetrieveAllLeads(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveAllLeads(
  CUserAuth  Caller,
  string  AccountId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveAllLeads(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLead privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in lead.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested leads. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<leads> + lead1..N + </leads>

where the XML schema for each lead is described by lead.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";
string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>leadid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve all leads
   string strResultsXml = account.RetrieveAllLeads(userAuth, strAccountId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • Retrieve
  • RetrieveSubLeads


CRMAccount.RetrieveAllOpportunities Method

The RetrieveAllOpportunities method retrieves all opportunities that are children of the account or children of the child contacts of the account.

Syntax

[Visual Basic .NET]
Public Function RetrieveAllOpportunities(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveAllOpportunities(
  CUserAuth  Caller,
  string  AccountId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveAllOpportunities(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in opportunity.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested opportunities. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<opportunities> + opportunity1..N + </opportunities>

where the XML schema for each opportunity schema is described by opportunity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>opportunityid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve all opportunities
   string strResultsXml = account.RetrieveAllOpportunities(userAuth, strAccountId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • Retrieve
  • RetrieveSubOpportunities


CRMAccount.RetrieveByObject Method

The RetrieveByObject method retrieves accounts associated with a particular object (lead or opportunity).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadAccount privilege to perform this action. See CUserAuth.
Object
Specifies the object to search for (lead or opportunity). See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in account.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested accounts. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<accounts> + account1..N + </accounts>

where the XML schema for each account is described by account.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strLeadId="{4B3F5AA7-790F-4E96-B921-DA65A106F4A1}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Initialize the lead object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strLeadId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otLead;

   // Retrieve all the accounts for the specified lead
   string strResultsXml = account.RetrieveByObject(userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • Retrieve


CRMAccount.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves all the accounts owned by the specified security principal.

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal Principal As CSecurityPrincipal,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  Principal,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  Principal,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadAccount privilege to perform this action. See CUserAuth.
Principal
Specifies the security principal whose accounts you want to retrieve. See CSecurityPrincipal.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in account.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the accounts requested for the specified security principal. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<accounts> + account1..N + </accounts>

where the XML schema for each account is described by account.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve all the accounts for the specified security principal
   string strAccountXml = account.RetrieveByPrincipal(userAuth, securityPrincipal, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • Retrieve


CRMAccount.RetrievePrincipalAccess Method

The RetrievePrincipalAccess method retrieves the access privileges the specified security principal has to the specified account.

Syntax

[Visual Basic .NET]
Public Function RetrievePrincipalAccess(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal Principal As CSecurityPrincipal
) As UInt32
[C#]
public uint RetrievePrincipalAccess(
  CUserAuth  Caller,
  string  AccountId,
  CSecurityPrincipal  Principal
);
[C++]
public: unsigned long RetrievePrincipalAccess(
  CUserAuth*  Caller,
  String*  AccountId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
Principal
Specifies the security principal to find for the account. See CSecurityPrincipal.

Return Value

Returns a UInt32 type that specifies the rights the security principal holds for the account. See ACCESSRIGHTS.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve the access for the principal
   uint access = account.RetrievePrincipalAccess(userAuth, strAccountId, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • Retrieve


CRMAccount.RetrieveSharedPrincipals Method

The RetrieveSharedPrincipals method returns a list of security principals with whom this account is shared.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipals(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal Rights As UInt32
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipals(
  CUserAuth  Caller,
  string  AccountId,
  uint  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipals(
  CUserAuth*  Caller,
  String*  AccountId,
  unsigned long  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
Rights
Specifies the set of rights in which you are interested. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of security principals requested. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";
string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Initialize security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;

   // Retrieve shared principal access
   securityPrincipals = account.RetrieveSharedPrincipals(userAuth, strAccountId, Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • Retrieve
  • RetrieveSharedPrincipalsAndAccess


CRMAccount.RetrieveSharedPrincipalsAndAccess Method

The RetrieveSharedPrincipalsAndAccess method retrieves all the security principals (users or teams) that have access to the specified account, along with their access rights.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipalsAndAccess(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByRef Rights As UInt32()
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipalsAndAccess(
  CUserAuth  Caller,
  string  AccountId,
  out uint[]  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipalsAndAccess(
  CUserAuth*  Caller,
  String*  AccountId,
  unsigned long*  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
Rights
[out] Specifies the array of rights for the security principals requested. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of security principals requested. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";
string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
uint[] rights;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Initialize security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;

   // Retrieve the shared principals and their access
   securityPrincipals = account.RetrieveSharedPrincipalsAndAccess(userAuth, strAccountId, out rights);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • Retrieve
  • RetrieveSharedPrincipals


CRMAccount.RetrieveSubAccounts Method

The RetrieveSubAccounts method retrieves the sub-accounts of the specified account.

Syntax

[Visual Basic .NET]
Public Function RetrieveSubAccounts(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveSubAccounts(
  CUserAuth  Caller,
  string  AccountId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveSubAccounts(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in account.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested sub-accounts. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<accounts> + account1..N + </accounts>

where the XML schema for each account is described by account.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the accounts
   string strResultsXml  = account.RetrieveSubAccounts(userAuth, strAccountId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • Retrieve


CRMAccount.RetrieveSubContacts Method

The RetrieveSubContacts method retrieves the sub-contacts of the specified account.

Syntax

[Visual Basic .NET]
Public Function RetrieveSubContacts(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveSubContacts(
  CUserAuth  Caller,
  string  AccountId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveSubContacts(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContact privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contact.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the sub-contacts requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<contacts> + contacts1..N + </contacts>

where the XML schema for each contact is described by contact.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>contactid</column>";
   strColumnSetXml += "<column>fullname</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the contacts
   string strResultsXml  = account.RetrieveSubContacts(userAuth, strAccountId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • Retrieve


CRMAccount.RetrieveSubLeads Method

The RetrieveSubLeads method retrieves the child leads of the specified account.

Syntax

[Visual Basic .NET]
Public Function RetrieveSubLeads(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveSubLeads(
  CUserAuth  Caller,
  string  AccountId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveSubLeads(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLead privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in lead.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested leads. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<leads> + lead1..N + </leads>

where the XML schema for each lead is described by lead.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>leadid</column>";
   strColumnSetXml += "<column>fullname</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the leads
   string strResultsXml  = account.RetrieveSubLeads(userAuth, strAccountId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • Retrieve
  • RetrieveAllLeads


CRMAccount.RetrieveSubOpportunities Method

The RetrieveSubOpportunities method retrieves the child opportunities of the specified account.

Syntax

[Visual Basic .NET]
Public Function RetrieveSubOpportunities(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveSubOpportunities(
  CUserAuth  Caller,
  string  AccountId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveSubOpportunities(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in opportunity.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested opportunities. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<opportunities> + opportunity1..N + </opportunities>

where the XML schema for each opportunity is described by opportunity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>opportunityid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the opportunities
   string strResultsXml  = account.RetrieveSubOpportunities(userAuth, strAccountId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class
  • Retrieve
  • RetrieveAllOpportunities


CRMAccount.RevokeAccess Method

The RevokeAccess method revokes access rights to the account for the specified security principal. This method also applies to all child objects of the account. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the account. In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

Syntax

[Visual Basic .NET]
Public Sub RevokeAccess(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal Revokee As CSecurityPrincipal
)
[C#]
public void RevokeAccess(
  CUserAuth  Caller,
  string  AccountId,
  CSecurityPrincipal  Revokee
);
[C++]
public: void RevokeAccess(
  CUserAuth*  Caller,
  String*  AccountId,
  CSecurityPrincipal*  Revokee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
Revokee
Specifies the team or user whose access will be revoked. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set the rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Grant access
   account.GrantAccess(userAuth, strAccountId, rights, securityPrincipal);

   // Now revoke access
   account.RevokeAccess(userAuth, strAccountId, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAccount Class


CRMAccount.SetPrimaryContact Method

The SetPrimaryContact method sets the primary contact for the specified account.

Syntax

[Visual Basic .NET]
Public Sub SetPrimaryContact(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal ContactId As String
)
[C#]
public void SetPrimaryContact(
  CUserAuth  Caller,
  string  AccountId,
  string  ContactId
);
[C++]
public: void SetPrimaryContact(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  ContactId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account.
ContactId
Specifies the ID of the new primary contact.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";
string strErrorMsg;
string strContactId = "{5J84E79C-7E9I-324K-HK89-9K86FEJK534C}";
string strAccountId = "{3E24E79K-7EC5-4473-95FF-7E46FELM534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set the primary contact
   account.SetPrimaryContact(userAuth, strAccountId, strContactId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • GetPrimaryContact
  • CRMAccount Class


CRMAccount.Update Method

The Update method updates the specified account record.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal Account As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  AccountId,
  string  Account
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  Account
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteAccount privilege to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account to be updated.
Account
Specifies an XML string containing the new account information. The XML schema is described by account.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";
string strErrorMsg;
string strAccountId = "{3E24E79K-7EC5-4473-95FF-7E46FELM534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the update
   string strAccountXml = "<account>";
   strAccountXml += "<numberofemployees>1928</numberofemployees>";
   strAccountXml += "</account>";

   // Update the account
   account.Update(userAuth, strAccountId, strAccountXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMAccount Class
  • UpdateAndRetrieve


CRMAccount.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates the specified account record and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal AccountId As String,
  ByVal InAccountXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  AccountId,
  string  InAccountXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  AccountId,
  String*  InAccountXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteAccount and prvReadAccount privileges to perform this action. See CUserAuth.
AccountId
Specifies the ID of the account to be updated.
InAccountXml
Specifies an XML string containing the new account information. The XML schema is described by account.xsd.

Return Value

Returns a String type that specifies the XML data describing the newly updated account. The XML schema is described by account.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strAccountId = "{3E24E79K-7EC5-4473-95FF-7E46FELM534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the update
   string strAccountXml = "<account>";
   strAccountXml += "<numberofemployees>1928</numberofemployees>";
   strAccountXml += "</account>";

   // Now update the account, and then retrieve it
   string strResultsXml = account.UpdateAndRetrieve(userAuth, strAccountId, strAccountXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMAccount Class
  • Update


CRMActivity Class

The CRMActivity class contains methods that you can use to manage activities.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMActivity
[Visual Basic .NET]
Public Class CRMActivity
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMActivity : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMActivity: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMActivity class exposes the following methods.

Method | Description
Cancel | Sets the activity state to Canceled.
Close | Sets the activity state to Closed.
Create | Creates a new activity.
CreateAndRetrieve | Creates a new activity and then retrieves it.
Delete | Deletes an activity.
GetActivityParties | Returns a list of the involved parties for the specified activity.
GrantAccess | Grants a user or team access to the specified activity
Handle | Moves an activity to the In Progress (WIPBin) queue of the user.
MakePrivate | Makes the specified activity private.
MakePublic | Makes the specified activity public.
ModifyAccess | Replaces the access rights on the activity for the specified security principal.
Open | Sets the activity state to Open.
Retrieve | Retrieves all the information for an activity.
RetrieveByObject | Retrieves activities associated with a particular object.
RetrieveByParty | Retrieves all activities for a given activity party.
RetrieveByPrincipal | Retrieves a set of activities for specific principal.
RetrievePrincipalAccess | Retrieves the access a specific security principal has to a specific activity.
RetrieveSharedPrincipals | Retrieves a list of security principals with which the activity is shared.
RetrieveSharedPrincipalsAndAccess | Retrieves all the security principals (users or teams) that have access to an activity, along with what access they have.
RevokeAccess | Revokes access to an activity.
Route | Routes an activity. This moves the activity to the private or public queue or the user or does auto-routing.
SetActivityParties | Deletes all existing parties for the specified activity and creates a set of new parties.
UnHandle | Not supported in this version.
Update | Updates an activity.
UpdateAndRetrieve | Updates an activity and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMActivity.Cancel Method

The Cancel method sets the activity state to Canceled.

Syntax

[Visual Basic .NET]
Public Sub Cancel(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByVal Status As Integer
)
[C#]
public void Cancel(
  CUserAuth  Caller,
  string  ActivityId,
  int  Status
);
[C++]
public: void Cancel(
  CUserAuth*  Caller,
  String*  ActivityId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity to cancel.
Status
Specifies the status of the activity. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";
string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Cancel the activity
   activity.Cancel(userAuth, strActivityId, -1);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class


CRMActivity.Close Method

The Close method sets the activity state to Closed.

Syntax

[Visual Basic .NET]
Public Sub Close(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByVal Status As Integer
)
[C#]
public void Close(
  CUserAuth  Caller,
  string  ActivityId,
  int  Status
);
[C++]
public: void Close(
  CUserAuth*  Caller,
  String*  ActivityId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity to cancel.
Status
Specifies the status of the activity. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";
string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Close the activity
   activity.Close(userAuth, strActivityId, -1);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}]

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class
  • Open


CRMActivity.Create Method

The Create method creates a new activity.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal ActivityXml As String,
  ByVal PartyXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  ActivityXml,
  string  PartyXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  ActivityXml,
  String*  PartyXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateActivity privilege to perform this action. See CUserAuth.
ActivityXml
Specifies an XML string containing the activity information. The XML schema is described by activity.xsd.
PartyXml
Specifies an XML string containing the party information. The XML schema is described by activityparty.xsd. See Remarks.

Return Value

Returns a String type that specifies the ID for the newly created Activity.

Remarks

Parties of the type ACTIVITY_PARTY_OWNER and ACTIVITY_PARTY_REGARDING are read-only. This method ignores activity parties of these types.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strLeadId="{75682232-E34F-47E1-8998-F0818D1E1CBD}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the activity
   string strXml = "<activity>";
   strXml += "<subject>Activity 1</subject>";
   strXml += "<activitytypecode>134</activitytypecode>";
   strXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() + "\">";
   strXml += userAuth.UserId + "</ownerid>";
   strXml += "</activity>";

   // Set up the XML string for the activity party
   string activityPartyXml = "<activityparties>";
   activityPartyXml += "<activityparty><partyid>" + strLeadId + "</partyid>";
   activityPartyXml += "<partyobjecttypecode>" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString();
   activityPartyXml += "</partyobjecttypecode>";
   activityPartyXml += "<participationtypemask>" + Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_OPTIONALATTENDEE.ToString();
   activityPartyXml += "</participationtypemask></activityparty></activityparties>";

   // Create the activity
   string strActivityId = activity.Create(userAuth, strXml, activityPartyXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMActivity Class
  • Update


CRMActivity.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new activity and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ActivityXml As String,
  ByVal PartiesXml As String,
  ByRef OutPartiesXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  ActivityXml,
  string  PartiesXml,
  out string  OutPartiesXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  ActivityXml,
  String*  PartiesXml,
  String**  OutPartiesXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateActivity and prvReadActivity privileges to perform this action. See CUserAuth.
ActivityXml
Specifies an XML string containing the activity information. The XML schema is described by activity.xsd.
PartiesXml
Specifies an XML string containing the parties. The XML schema is described by activityparty.xsd.
OutPartiesXml
[out] Specifies an XML string containing the new party information. The XML schema is described by activityparty.xsd.

Return Value

Returns a String type that specifies the XML data containing the newly created activity information. The XML schema is described by activity.xsd.

Remarks

Parties of the type ACTIVITY_PARTY_OWNER and ACTIVITY_PARTY_REGARDING are read-only. This method ignores activity parties of these types.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strLeadId ="{75682232-E34F-47E1-8998-F0818D1E1CBD}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the activity
   string strXml = "<activity>";
   strXml += "<subject>Activity 1</subject>";
   strXml += "<activitytypecode>134</activitytypecode>";
   strXml += "<ownerid type=\""   + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() + "\">";
   strXml += userAuth.UserId + "</ownerid>";
   strXml += "</activity>";

   // Set up the XML string for the activity party
   string activityPartyXml = "<activityparties>";
   activityPartyXml += "<activityparty><partyid>" + strLeadId + "</partyid>";
   activityPartyXml += "<partyobjecttypecode>" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString();
   activityPartyXml += "</partyobjecttypecode>";
   activityPartyXml += "<participationtypemask>" + Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_OPTIONALATTENDEE.ToString();
   activityPartyXml += "</participationtypemask></activityparty></activityparties>";

   string outPartiesXml = "";

   // Create and then retrieve the activity
   string strActivityXml = activity.CreateAndRetrieve(userAuth, strXml, activityPartyXml, out outPartiesXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMActivity Class
  • UpdateAndRetrieve


CRMActivity.Delete Method

The Delete method deletes an activity.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ActivityId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ActivityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity to delete.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the activity
   activity.Delete(userAuth, strActivityId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class


CRMActivity.GetActivityParties Method

The GetActivityParties method retrieves a list of the involved parties for the specified activity.

Syntax

[Visual Basic .NET]
Public Function GetActivityParties(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string GetActivityParties(
  CUserAuth  Caller,
  string  ActivityId,
  string  ColumnSetXml
);
[C++]
public: String* GetActivityParties(
  CUserAuth*  Caller,
  String*  ActivityId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity to find.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in activityparty.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested parties. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<activityparties> + activityparty1..N + </activityparties>

where the XML schema for each activity party is described by activityparty.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>activitypartyid</column>";
   strColumnSetXml += "<column>partyid</column>";
   strColumnSetXml += "</columnset>";

   string strPartiesXML = activity.GetActivityParties(userAuth, strActivityId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class
  • SetActivityParties


CRMActivity.GrantAccess Method

The GrantAccess method grants a user or team access to the specified activity. This method also applies to all child objects of the activity. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the activity. In this case, only the lack of privileges for a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub GrantAccess(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void GrantAccess(
  CUserAuth  Caller,
  string  ActivityId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void GrantAccess(
  CUserAuth*  Caller,
  String*  ActivityId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity.
Rights
Specifies the set of rights to be granted. See ACCESSRIGHTS.
Grantee
Specifies the security principal (user or team) with which the activity is to be shared. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();
   // Initialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set up the rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   activity.GrantAccess(userAuth, strActivityId, rights, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class


CRMActivity.Handle Method

The Handle method moves an activity to the In Progress (WIPBin) queue of the user.

Syntax

[Visual Basic .NET]
Public Sub Handle(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal SourceQueueId As String
)
[C#]
public void Handle(
  CUserAuth  Caller,
  string  EntityId,
  string  SourceQueueId
);
[C++]
public: void Handle(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  SourceQueueId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the object (activity).
SourceQueueId
Specifies the ID of the source queue.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
string strQueueId = "{JKDED4LL-GH90-43ED-73A9-0B33D205F9N8}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Handle the activity
   activity.Handle(userAuth, strActivityId, strQueueId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class


CRMActivity.MakePrivate Method

The MakePrivate method makes the activity unavailable to anyone except the owner and the users that share the object. Only the owner of an activity can make it private. By default, all objects are public. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub MakePrivate(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String
)
[C#]
public void MakePrivate(
  CUserAuth  Caller,
  string  ActivityId
);
[C++]
public: void MakePrivate(
  CUserAuth*  Caller,
  String*  ActivityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvWriteActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity to make private.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if an object is made private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make it private
   activity.MakePrivate(userAuth, strActivityId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class
  • MakePublic


CRMActivity.MakePublic Method

The MakePublic method makes an activity available to all users. Only the owner of an activity can make it public. By default, all objects are public. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub MakePublic(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String
)
[C#]
public void MakePublic(
  CUserAuth  Caller,
  string  ActivityId
);
[C++]
public: void MakePublic(
  CUserAuth*  Caller,
  String*  ActivityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvWriteActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity to make public.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if an object is made private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make it public
   activity.MakePublic(userAuth, strActivityId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class
  • MakePrivate


CRMActivity.ModifyAccess Method

The ModifyAccess method replaces the access rights on the activity for the specified security principal. This method also applies to all child objects of the activity. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the activity. In this case, only the lack of privileges to a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub ModifyAccess(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void ModifyAccess(
  CUserAuth  Caller,
  string  ActivityId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void ModifyAccess(
  CUserAuth*  Caller,
  String*  ActivityId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvShareActivity to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity.
Rights
Specifies the set of rights to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or user that will be granted access. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Initialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set up the rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_WRITE;

   // Modify access for the security principal
   activity.ModifyAccess(userAuth, strActivityId, rights, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class


CRMActivity.Open Method

The Open method sets the activity state to Open.

Syntax

[Visual Basic .NET]
Public Sub Open(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByVal Status As Integer
)
[C#]
public void Open(
  CUserAuth  Caller,
  string  ActivityId,
  int  Status
);
[C++]
public: void Open(
  CUserAuth*  Caller,
  String*  ActivityId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity to open.
Status
Specifies the status of the activity. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Close the activity
   activity.Close(userAuth, strActivityId, -1);

   // Now open the activity
   activity.Open(userAuth, strActivityId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Close
  • CRMActivity Class


CRMActivity.Retrieve Method

The Retrieve method retrieves all the information for the specified activity.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByRef OutPartiesXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  ActivityId,
  out string  OutPartiesXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  ActivityId,
  String**  OutPartiesXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity to retrieve.
OutPartiesXml
[out] Specifies an XML string containing the requested parties. The XML schema is described by activityparty.xsd.

Return Value

Returns a String type that specifies the XML data containing the requested activities. The XML schema is described by activity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strPartiesXml;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve all the information for the activity
   string strResultsXml = activity.Retrieve(userAuth, strActivityId, out strPartiesXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class
  • RetrieveByObject
  • RetrieveByParty
  • RetrieveByPrincipal
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipals
  • RetrieveSharedPrincipalsAndAccess


CRMActivity.RetrieveByObject Method

The RetrieveByObject method retrieves all related activities for a specified object:

  • If the object is a contact, retrieve all Activities with ContactId and all Activity - ActivityParties with ContactId.
  • If the object is an account, retrieve all Activities with ActivityId and all Activity - ActivityParties with ActivityId.
  • If the object is an opportunity, incident (case), or lead, retrieve all activities that are linked to the object.

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Entity As CObjectName,
  ByVal StartDate As String,
  ByVal EndDate As String,
  ByVal ActivityTypeCode As ObjectType(),
  ByVal ActivityStateCode As ACTIVITY_STATE(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Entity,
  string  StartDate,
  string  EndDate,
  ObjectType[]  ActivityTypeCode,
  ACTIVITY_STATE[]  ActivityStateCode,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Entity,
  String*  StartDate,
  String*  EndDate,
  ObjectType  ActivityTypeCode __gc[],
  ACTIVITY_STATE  ActivityStateCode __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
Entity
Specifies the object (account, contact, opportunity, incident, or lead) to find. See CObjectName.
StartDate
Specifies the start date. Use this to retrieve activities that happen after this date.
EndDate
Specifies the end date. Use this to retrieve activities that happen before this date.
ActivityTypeCode
Retrieve the types of activities specified in this array.
ActivityStateCode
Retrieve activities in the states specified in this array. See ACTIVITY_STATE.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in activity.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested activities. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<activities> + activity1..N + </activities>

where the XML schema for each activity is described by activity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{75682232-E34F-47E1-8998-F0818D1E1CBD}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>activityid</column>";
   strColumnSetXml += "<column>activitytypecode</column>";
   strColumnSetXml += "</columnset>";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strLeadId;
   objName.Type =Microsoft.Crm.Platform.Proxy.ObjectType.otLead;

   Microsoft.Crm.Platform.Proxy.ObjectType[] activityTypes = new Microsoft.Crm.Platform.Proxy.ObjectType[2];
   activityTypes[0] = Microsoft.Crm.Platform.Proxy.ObjectType.otLetterActivity;
   activityTypes[1] = Microsoft.Crm.Platform.Proxy.ObjectType.otActivity;

   Microsoft.Crm.Platform.Types.ACTIVITY_STATE[] activityStates = new Microsoft.Crm.Platform.Types.ACTIVITY_STATE[12];
   activityStates[0] = Microsoft.Crm.Platform.Types.ACTIVITY_STATE.ACTS_OPEN;

   // Retrieve all the activities for the specified object
   // This example has no start date nor end date specified
   string strResultsXml = activity.RetrieveByObject(userAuth, objName, "", "", activityTypes, activityStates, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class
  • Retrieve


CRMActivity.RetrieveByParty Method

The RetrieveByParty method retrieves all activities for a given activity party.

Syntax

[Visual Basic .NET]
Public Function RetrieveByParty(
  ByVal Caller As CUserAuth,
  ByVal Party As CObjectName,
  ByVal StartDate As String,
  ByVal EndDate As String,
  ByVal ActivityTypeCode As ObjectType(),
  ByVal ActivityStateCode As ACTIVITY_STATE(),
  ByVal PartyTypeCode As ACTIVITY_PARTY_TYPE(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByParty(
  CUserAuth  Caller,
  CObjectName  Party,
  string  StartDate,
  string  EndDate,
  ObjectType[]  ActivityTypeCode,
  ACTIVITY_STATE[]  ActivityStateCode,
  ACTIVITY_PARTY_TYPE[]  PartyTypeCode,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByParty(
  CUserAuth*  Caller,
  CObjectName*  Party,
  String*  StartDate,
  String*  EndDate,
  ObjectType  ActivityTypeCode __gc[],
  ACTIVITY_STATE  ActivityStateCode __gc[],
  ACTIVITY_PARTY_TYPE  PartyTypeCode __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
Party
Specifies the party to find. See CObjectName.
StartDate
Specifies the start date. Use this to retrieve activities that happen after this date.
EndDate
Specifies the end date. Use this to retrieve activities that happen before this date.
ActivityTypeCode
Retrieves the types of activities specified in this array.
ActivityStateCode
Retrieves activities in the states specified in this array. See ACTIVITY_STATE.
PartyTypeCode
Retrieves activities for the party types specified in this array. See ACTIVITY_PARTY_TYPE.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in activity.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested activities. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<activities> + activity1..N + </activities>

where the XML schema for each activity is described by activity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strLeadId = "{75682232-E34F-47E1-8998-F0818D1E1CBD}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>activityid</column>";
   strColumnSetXml += "<column>activitytypecode</column>";
   strColumnSetXml += "</columnset>";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strLeadId;
   objName.Type =Microsoft.Crm.Platform.Proxy.ObjectType.otLead;

   Microsoft.Crm.Platform.Proxy.ObjectType[] activityTypes = new Microsoft.Crm.Platform.Proxy.ObjectType[2];
   activityTypes[0] = Microsoft.Crm.Platform.Proxy.ObjectType.otLetterActivity;
   activityTypes[1] = Microsoft.Crm.Platform.Proxy.ObjectType.otActivity;

   Microsoft.Crm.Platform.Types.ACTIVITY_STATE[] activityStates = new Microsoft.Crm.Platform.Types.ACTIVITY_STATE[1];
   activityStates[0] = Microsoft.Crm.Platform.Types.ACTIVITY_STATE.ACTS_OPEN;

   Microsoft.Crm.Platform.Proxy.ACTIVITY_PARTY_TYPE[] activityPartyTypes = new Microsoft.Crm.Platform.Proxy.ACTIVITY_PARTY_TYPE[2];
   activityPartyTypes[0] = Microsoft.Crm.Platform.Proxy.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_OWNER;
   activityPartyTypes[1] = Microsoft.Crm.Platform.Proxy.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_ORGANIZER;

   // Retrieve all the activities for the specified object
   // This example has no start date nor end date specified
   string strActivityXml = activity.RetrieveByParty(userAuth, objName, "", "", activityTypes, activityStates, activityPartyTypes, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class
  • Retrieve


CRMActivity.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves a set of activities for a specific principal. If the principal is a user, the method returns all activities owned by the user and all activities for which the user is responsible. If the principal is a team, this method returns all activities the team owns.

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal Principal As CSecurityPrincipal,
  ByVal StartDate As String,
  ByVal EndDate As String,
  ByVal ActivityTypeCode As ObjectType(),
  ByVal ActivityStateCode As ACTIVITY_STATE(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  Principal,
  string  StartDate,
  string  EndDate,
  ObjectType[]  ActivityTypeCode,
  ACTIVITY_STATE[]  ActivityStateCode,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  Principal,
  String*  StartDate,
  String*  EndDate,
  ObjectType  ActivityTypeCode __gc[],
  ACTIVITY_STATE  ActivityStateCode __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
Principal
Specifies the principal whose activities you want to retrieve. See CSecurityPrincipal.
StartDate
Specifies the start date. Use this to retrieve activities that happen after this date.
EndDate
Specifies the end date. Use this to retrieve activities that happen before this date.
ActivityTypeCode
Retrieves the types of activities specified in this array. See ObjectType.
ActivityStateCode
Retrieves activities in the states specified in this array. See ACTIVITY_STATE.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in activity.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested activities. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<activities> + activity1..N + </activities>

where the XML schema for each activity is described by activity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>objectname</column>";
   strColumnSetXml += "<column>activitytypecode</column>";
   strColumnSetXml += "<column>objectid</column>";
   strColumnSetXml += "<column>objecttypecode</column>";
   strColumnSetXml += "<column>directioncode</column>";
   strColumnSetXml += "<column>subject</column>";
   strColumnSetXml += "<column>subject</column>";
   strColumnSetXml += "</columnset>";

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   Microsoft.Crm.Platform.Proxy.ObjectType[] activityTypes = new Microsoft.Crm.Platform.Proxy.ObjectType[2];
   activityTypes[0] = Microsoft.Crm.Platform.Proxy.ObjectType.otLetterActivity;
   activityTypes[1] = Microsoft.Crm.Platform.Proxy.ObjectType.otActivity;

   Microsoft.Crm.Platform.Types.ACTIVITY_STATE[] activityStates = new Microsoft.Crm.Platform.Types.ACTIVITY_STATE[12];
   activityStates[0] = Microsoft.Crm.Platform.Types.ACTIVITY_STATE.ACTS_OPEN;

   // Retrieve all the activities for the specified security principal
   string strActivityXml = activity.RetrieveByPrincipal(userAuth, securityPrincipal, "", "", activityTypes, activityStates, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class
  • Retrieve


CRMActivity.RetrievePrincipalAccess Method

The RetrievePrincipalAccess method retrieves the access a specific security principal has to a specific activity.

Syntax

[Visual Basic .NET]
Public Function RetrievePrincipalAccess(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByVal Principal As CSecurityPrincipal
) As UInt32
[C#]
public uint RetrievePrincipalAccess(
  CUserAuth  Caller,
  string  ActivityId,
  CSecurityPrincipal  Principal
);
[C++]
public: unsigned long RetrievePrincipalAccess(
  CUserAuth*  Caller,
  String*  ActivityId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity to find.
Principal
Specifies the security principle. See CSecurityPrincipal.

Return Value

Returns a UInt32 type that specifies the access rights found for the specified principal. See ACCESSRIGHTS.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Initialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve the access rights for the security principal
   uint access = activity.RetrievePrincipalAccess(userAuth, strActivityId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class
  • Retrieve


CRMActivity.RetrieveSharedPrincipals Method

The RetrieveSharedPrincipals method returns a list of security principals with which the activity is shared given the specified access rights.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipals(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByVal Rights As UInt32
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipals(
  CUserAuth  Caller,
  string  ActivityId,
  uint  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipals(
  CUserAuth*  Caller,
  String*  ActivityId,
  unsigned long  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity.
Rights
Specifies the set of access rights the principals may have for the activity. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of security principals found. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the shared principals
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals = activity.RetrieveSharedPrincipals(userAuth, strActivityId, Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class
  • Retrieve
  • RetrieveSharedPrincipalsAndAccess


CRMActivity.RetrieveSharedPrincipalsAndAccess Method

The RetrieveSharedPrincipalsAndAccess method retrieves all the security principals (users or teams) that have access to an activity, along with what access they have.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipalsAndAccess(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByRef Rights As UInt32()
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipalsAndAccess(
  CUserAuth  Caller,
  string  ActivityId,
  out uint[]  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipalsAndAccess(
  CUserAuth*  Caller,
  String*  ActivityId,
  unsigned long*  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity.
Rights
[out] Specifies the array of rights requested. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of principals requested. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
uint[] rights;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the shared principals and their access
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals = activity.RetrieveSharedPrincipalsAndAccess(userAuth, strActivityId, out rights);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class
  • Retrieve
  • RetrieveSharedPrincipals


CRMActivity.RevokeAccess Method

The RevokeAccess method revokes access rights to the activity for the specified security principal. This method also applies to all child objects of the activity. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the activity. In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

Syntax

[Visual Basic .NET]
Public Sub RevokeAccess(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByVal Revokee As CSecurityPrincipal
)
[C#]
public void RevokeAccess(
  CUserAuth  Caller,
  string  ActivityId,
  CSecurityPrincipal  Revokee
);
[C++]
public: void RevokeAccess(
  CUserAuth*  Caller,
  String*  ActivityId,
  CSecurityPrincipal*  Revokee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity.
Revokee
Specifies the security principal for which access is to be revoked. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Grant access to the activity
   activity.GrantAccess(userAuth, strActivityId, rights, securityPrincipal);

   // Now revoke access
   activity.RevokeAccess(userAuth, strActivityId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class


CRMActivity.Route Method

The Route method routes an activity. This moves the activity to the private or public queue of the user or does auto-routing.

Syntax

[Visual Basic .NET]
Public Sub Route(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal SourceQueueId As String,
  ByVal RouteTypeCode As ROUTE_TYPE_CODE,
  ByVal EndPointId As String
)
[C#]
public void Route(
  CUserAuth  Caller,
  string  EntityId,
  string  SourceQueueId,
  ROUTE_TYPE_CODE  RouteTypeCode,
  string  EndPointId
);
[C++]
public: void Route(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  SourceQueueId,
  ROUTE_TYPE_CODE  RouteTypeCode,
  String*  EndPointId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity privilege to perform this action. See CUserAuth.
EntityId
[in] Specifies the ID of the object.
SourceQueueId
[in] Specifies the ID of the source queue.
ROUTE_TYPE_CODE
[in] Specifies the route type code. See ROUTE_TYPE_CODE. See Remarks.
EndPointId
[in] Specifies the ID of the end point. See Remarks.

Return Value

No return value.

Remarks

If the ROUTE_TYPE_CODE is RTC_QUEUE, then EndPointID should be the ID of a queue.

If the ROUTE_TYPE_CODE is RTC_USER, then EndPointID should be the ID of a user.

If the ROUTE_TYPE_CODE is RTC_AUTO, then EndPointID is ignored.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
string strQueueId = "{JKDED4LL-GH90-43ED-73A9-0B33D205F9N8}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Route the activity
   activity.Route(userAuth, strActivityId, strQueueId, Microsoft.Crm.Platform.Proxy.ROUTE_TYPE_CODE.RTC_USER, strQueueId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivity Class


CRMActivity.SetActivityParties Method

The SetActivityParties method deletes all existing parties for the specified activity and creates a set of new parties.

Syntax

[Visual Basic .NET]
Public Sub SetActivityParties(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByVal PartiesXml As String
)
[C#]
public void SetActivityParties(
  CUserAuth  Caller,
  string  ActivityId,
  string  PartiesXml
);
[C++]
public: void SetActivityParties(
  CUserAuth*  Caller,
  String*  ActivityId,
  String*  PartiesXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity.
PartiesXml
Specifies an XML string describing the parties. This XML string is in the format
<activityparties> + activityparty1..N + </activityparties>

where the XML schema for each activity party is described by activityparty.xsd. See Remarks.

Return Value

No return value.

Remarks

Parties of the type ACTIVITY_PARTY_OWNER and ACTIVITY_PARTY_REGARDING are read-only. This method ignores activity parties of these types.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strLeadId = "{75682232-E34F-47E1-8998-F0818D1E1CBD}";
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the activity
   string strPartiesXml = "<activityparties>";
   strPartiesXml += "<activityparty><partyid>" + strLeadId + "</partyid>";
   strPartiesXml += "<partyobjecttypecode>" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString();
   strPartiesXml += "</partyobjecttypecode>";
   strPartiesXml += "<participationtypemask>" + Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_OPTIONALATTENDEE.ToString();
   strPartiesXml += "</participationtypemask>";
   strPartiesXml += "</activityparty></activityparties>";

   // Set the activity parties for the specified activity
   activity.SetActivityParties(userAuth, strActivityId, strPartiesXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • GetActivityParties
  • CRMActivity Class


CRMActivity.Update Method

The Update method updates an activity.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByVal ActivityXml As String,
  ByVal PartiesXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  ActivityId,
  string  ActivityXml,
  string  PartiesXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  ActivityId,
  String*  ActivityXml,
  String*  PartiesXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity privilege to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity to update.
ActivityXml
Specifies an XML string containing the activity information. The XML schema is described by activity.xsd.
PartiesXml
Specifies an XML string describing the parties. The XML schema is described by activityparty.xsd. See Remarks.

Return Value

No return value.

Remarks

Parties of the type ACTIVITY_PARTY_OWNER and ACTIVITY_PARTY_REGARDING are read-only. This method ignores activity parties of these types.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strLeadId="{75682232-E34F-47E1-8998-F0818D1E1CBD}";
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the activity
   string strXml = "<activity>";
   strXml += "<description>This is to discuss our new project.</description>";
   strXml += "</activity>";

   string activityPartyXml = "<activityparties>";
   activityPartyXml += "<activityparty><partyid>" + strLeadId + "</partyid>";
   activityPartyXml += "<partyobjecttypecode>" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString();
   activityPartyXml += "</partyobjecttypecode>";
   activityPartyXml += "<participationtypemask>" + Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_REQUIREDATTENDEE.ToString();
   activityPartyXml += "</participationtypemask></activityparty></activityparties>";

   // Now update the activity
   activity.Update(userAuth, strActivityId, strXml, activityPartyXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMActivity Class
  • UpdateAndRetrieve


CRMActivity.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an activity and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ActivityId As String,
  ByVal ActivityXml As String,
  ByVal PartiesXml As String,
  ByRef OutPartiesXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  ActivityId,
  string  ActivityXml,
  string  PartiesXml,
  out string  OutPartiesXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  ActivityId,
  String*  ActivityXml,
  String*  PartiesXml,
  String**  OutPartiesXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity and prvReadActivity privileges to perform this action. See CUserAuth.
ActivityId
Specifies the ID of the activity.
ActivityXml
Specifies an XML string containing the activity information. The XML schema is described by activity.xsd.
PartiesXml
Specifies an XML string describing the parties. The XML schema is described by activityparty.xsd.
OutPartiesXml
[out] Specifies an XML string containing the parties retrieved. The XML schema is described by activityparty.xsd.

Return Value

Returns a String type that specifies the XML data containing the activities retrieved. The XML schema is described by activity.xsd.

Remarks

Parties of the type ACTIVITY_PARTY_OWNER and ACTIVITY_PARTY_REGARDING are read-only. This method ignores activity parties of these types.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

string strErrorMsg;
string strNewPartiesXml;
string strLeadId = "{75682232-E34F-47E1-8998-F0818D1E1CBD}";
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the activity
   string strXml = "<activity>";
   strXml += "<description>This is to discuss our new project.</description>";
   strXml += "</activity>";

   string activityPartyXml = "<activityparties>";
   activityPartyXml += "<activityparty><partyid>" + strLeadId + "</partyid>";
   activityPartyXml += "<partyobjecttypecode>" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString();
   activityPartyXml += "</partyobjecttypecode>";
   activityPartyXml += "<participationtypemask>" + Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_REQUIREDATTENDEE.ToString();
   activityPartyXml += "</participationtypemask></activityparty></activityparties>";

   // Now update and then retrieve the activity
   string strNewActivityXml = activity.UpdateAndRetrieve(userAuth, strActivityId, strXml, activityPartyXml, out strNewPartiesXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMActivity Class
  • Update


CRMActivityAttachment Class

The CRMActivityAttachment class contains methods that you can use to manage activity attachments.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMActivityAttachment
[Visual Basic .NET]
Public Class CRMActivityAttachment
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMActivityAttachment : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMActivityAttachment: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMActivityAttachment class exposes the following methods.

Method | Description
Copy | Not supported in this version.
Create | Creates an attachment for an activity.
CreateAndRetrieve | Creates and then retrieves an activity attachment.
Delete | Deletes an activity attachment.
Retrieve | Retrieves an activity attachment.
RetrieveByObject | Retrieves the activity attachments associated with a particular activity.
RemoveBinaryData | Removes the binary data from an activity attachment.
Update | Updates an activity attachment.
UpdateAndRetrieve | Updates and then retrieves an activity attachment.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMActivityAttachment.Create Method

The Create method creates an attachment for an activity.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal EntityXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  EntityXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  EntityXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateActivity privilege to perform this action. See CUserAuth.
EntityXML
Specifies an XML string describing the attachment. The XML schema is described by activitymimeattachment.xsd.

Return Value

Returns a String type that specifies the ID of the newly created activity attachment.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivityAttachment proxy object
Microsoft.Crm.Platform.Proxy.CRMActivityAttachment activityAttachment = new Microsoft.Crm.Platform.Proxy.CRMActivityAttachment ();
activityAttachment.Credentials = System.Net.CredentialCache.DefaultCredentials;
activityAttachment.Url = strDir + "CRMActivityAttachment.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the activity attachment
   string strXml = "<activitymimeattachment>";
   strXml += "<subject>Activity 1</subject>";
   strXml += "<attachmentnumber>1</attachmentnumber>";
   strXml += "<activityid>" + strActivityId + "</activityid>";
   strXml += "</activitymimeattachment>";

   // Create the activity attachment
   string strAttachmentId = activityAttachment.Create(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMActivityAttachment Class
  • Update


CRMActivityAttachment.CreateAndRetrieve Method

The CreateAndRetrieve method creates and then retrieves an activity attachment.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityXml As String,
  ByVal ColumnSet As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  EntityXml,
  string  ColumnSet
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  EntityXml,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateActivity and prvReadActivity privileges to perform this action. See CUserAuth.
EntityXml
Specifies an XML string describing the attachment. The XML schema is described by activitymimeattachment.xsd.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in activitymimeattachment.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the newly created attachment. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by activitymimeattachment.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivityAttachment proxy object
Microsoft.Crm.Platform.Proxy.CRMActivityAttachment activityAttachment = new Microsoft.Crm.Platform.Proxy.CRMActivityAttachment ();
activityAttachment.Credentials = System.Net.CredentialCache.DefaultCredentials;
activityAttachment.Url = strDir + "CRMActivityAttachment.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the new attachment
   string strXml = "<activitymimeattachment>";
   strXml += "<subject>My Subject</subject>";
   strXml += "<attachmentnumber>3</attachmentnumber>";
   strXml += "<activityid>" + strActivityId + "</activityid>";
   strXml += "</activitymimeattachment>";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>activitymimeattachmentid</column>";
   strColumnSetXml += "<column>subject</column>";
   strColumnSetXml += "</columnset>";

   string strNewAttachmentXml = activityAttachment.CreateAndRetrieve(userAuth, strXml, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMActivityAttachment Class
  • UpdateAndRetrieve


CRMActivityAttachment.Delete Method

The Delete method deletes an activity attachment.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  EntityId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  EntityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteActivity privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the attachment to delete.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivityAttachment proxy object
Microsoft.Crm.Platform.Proxy.CRMActivityAttachment activityAttachment = new Microsoft.Crm.Platform.Proxy.CRMActivityAttachment ();
activityAttachment.Credentials = System.Net.CredentialCache.DefaultCredentials;
activityAttachment.Url = strDir + "CRMActivityAttachment.srf";

string strErrorMsg;
string strAttachmentId = "{6E2931EE-2C63-452D-ACD3-195103AB5BD5}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the activity attachment
   activityAttachment.Delete(userAuth, strAttachmentId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivityAttachment Class


CRMActivityAttachment.RemoveBinaryData Method

The Retrieve method removes the binary data from an activity attachment.

Syntax

[Visual Basic .NET]
Public Sub RemoveBinaryData(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String
)
[C#]
public void RemoveBinaryData(
  CUserAuth  Caller,
  string  EntityId
);
[C++]
public: void RemoveBinaryData(
  CUserAuth*  Caller,
  String*  EntityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the attachment for which binary data is to be removed.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivityAttachment proxy object
Microsoft.Crm.Platform.Proxy.CRMActivityAttachment activityAttachment = new Microsoft.Crm.Platform.Proxy.CRMActivityAttachment ();
activityAttachment.Credentials = System.Net.CredentialCache.DefaultCredentials;
activityAttachment.Url = strDir + "CRMActivityAttachment.srf";

string strErrorMsg;
string strAttachmentId = "{6E2931EE-2C63-452D-ACD3-195103AB5BD5}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Remove the binary data for the attachment
   activityAttachment.RemoveBinaryData(userAuth, strAttachmentId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivityAttachment Class


CRMActivityAttachment.Retrieve Method

The Retrieve method retrieves an activity attachment.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  EntityId,
  string  ColumnSet
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the attachment to retrieve.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in activitymimeattachment.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested attachment. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by activitymimeattachment.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivityAttachment proxy object
Microsoft.Crm.Platform.Proxy.CRMActivityAttachment activityAttachment = new Microsoft.Crm.Platform.Proxy.CRMActivityAttachment ();
activityAttachment.Credentials = System.Net.CredentialCache.DefaultCredentials;
activityAttachment.Url = strDir + "CRMActivityAttachment.srf";

string strErrorMsg;
string strAttachmentId = "{6E2931EE-2C63-452D-ACD3-195103AB5BD5}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the attachment. Passing a null string for ColumnSet retrieves all columns
   string strAttachmentXml = activityAttachment.Retrieve(userAuth, strAttachmentId, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivityAttachment Class
  • RetrieveByObject


CRMActivityAttachment.RetrieveByObject Method

The RetrieveByObject method retrieves activity attachments associated with a particular activity.

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Entity As CObjectName,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Entity,
  string  ColumnSet
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Entity,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
Entity
Specifies the object to search for. Retrieve all attachments for this object. See CObjectName.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in activitymimeattachment.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested attachments. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<activitymimeattachments> + activitymimeattachment1..N + </activitymimeattachments>

where the XML schema for each attachment is described by activitymimeattachment.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivityAttachment proxy object
Microsoft.Crm.Platform.Proxy.CRMActivityAttachment activityAttachment = new Microsoft.Crm.Platform.Proxy.CRMActivityAttachment ();
activityAttachment.Credentials = System.Net.CredentialCache.DefaultCredentials;
activityAttachment.Url = strDir + "CRMActivityAttachment.srf";

string strErrorMsg;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CObjectName objectName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objectName.Id = strActivityId;
   objectName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otActivity;

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>activitymimeattachmentid</column>";
   strColumnSetXml += "<column>filename</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve all the attachments for this object
   string strResultsXml = activityAttachment.RetrieveByObject(userAuth, objectName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMActivityAttachment Class
  • Retrieve


CRMActivityAttachment.Update Method

The Update method updates an activity attachment.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal EntityXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  EntityId,
  string  EntityXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  EntityXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the attachment to update.
EntityXml
Specifies an XML string describing the attachment. The XML schema is described by activitymimeattachment.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivityAttachment proxy object
Microsoft.Crm.Platform.Proxy.CRMActivityAttachment activityAttachment = new Microsoft.Crm.Platform.Proxy.CRMActivityAttachment ();
activityAttachment.Credentials = System.Net.CredentialCache.DefaultCredentials;
activityAttachment.Url = strDir + "CRMActivityAttachment.srf";

string strErrorMsg;
string strAttachmentId="{6E2931EE-2C63-452D-ACD3-195103AB5BD5}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the update
   string strXml = "<activitymimeattachment>";
   strXml += "<subject>My New Subject</subject>";
   strXml += "</activitymimeattachment>";

   // Now update the attachment
   activityAttachment.Update(userAuth, strAttachmentId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMActivityAttachment Class
  • UpdateAndRetrieve


CRMActivityAttachment.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates and then retrieves an activity attachment.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal EntityXml As String,
  ByVal ColumnSet As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  EntityId,
  string  EntityXml,
  string  ColumnSet
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  EntityXml,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity and prvReadActivity privileges to perform this action. See CUserAuth.
EntityId
Specifies the ID of the attachment to update.
EntityXml
Specifies an XML string describing the attachment. The XML schema is described by activitymimeattachment.xsd.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in activitymimeattachment.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested attachment. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by activitymimeattachment.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivityAttachment proxy object
Microsoft.Crm.Platform.Proxy.CRMActivityAttachment activityAttachment = new Microsoft.Crm.Platform.Proxy.CRMActivityAttachment ();
activityAttachment.Credentials = System.Net.CredentialCache.DefaultCredentials;
activityAttachment.Url = strDir + "CRMActivityAttachment.srf";

string strErrorMsg;
string strAttachmentId="{6E2931EE-2C63-452D-ACD3-195103AB5BD5}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the update
   string strXml = "<activitymimeattachment>";
   strXml += "<subject>My New Subject</subject>";
   strXml += "</activitymimeattachment>";

   // Set up which columns are to be retrieved
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>activityid</column>";
   strColumnSetXml += "<column>activitymimeattachmentid</column>";
   strColumnSetXml += "<column>attachmentnumber</column>";
   strColumnSetXml += "<column>subject</column>";
   strColumnSetXml += "</columnset>";

   // Now update the activity attachment, and then retrieve it
   string strResultsXml = activityAttachment.UpdateAndRetrieve(userAuth, strAttachmentId, strXml, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMActivityAttachment Class
  • Update


CRMAnswer Class

The CRMAnswer class contains methods that you can use to find published articles in the knowledge base. An answer is a set of published content (documents, knowledge base articles, URLs, internal objects) that is stored with searchable metadata.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMAnswer
[Visual Basic .NET]
Public Class CRMAnswer
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMAnswer : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMAnswer: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMAnswer class exposes the following methods.

Method | Description
Retrieve | Retrieves an existing answer to a query.
RetrieveByNumber | Retrieves an answer by the number specified.
RetrieveByObject | Retrieves the answer associated with the specified object.
RetrieveBySubject | Retrieves all the answers related to the specified subject.
SearchByBody | Executes a full-text search by body.
SearchByKeywords | Executes a full-text search by keywords.
SearchByTitle | Executes a full-text search by title.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMAnswer.Retrieve Method

The Retrieve method retrieves an existing answer.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal AnswerId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  AnswerId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  AnswerId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
AnswerId
Specifies the ID of the answer.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in documentindex.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the answers requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by documentindex.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAnswer proxy object
Microsoft.Crm.Platform.Proxy.CRMAnswer answer = new Microsoft.Crm.Platform.Proxy.CRMAnswer ();
answer.Credentials = System.Net.CredentialCache.DefaultCredentials;
answer.Url = strDir + "CRMAnswer.srf";

string strErrorMsg;

string strAnswerId = "{6522D89A-A752-4455-A2B0-51494C6957C3}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>subjectid</column>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the answer
   string strAnswerXml = answer.Retrieve(userAuth, strAnswerId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}

catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAnswer Class
  • RetrieveByNumber
  • RetrieveByObject
  • RetrieveBySubject


CRMAnswer.RetrieveByNumber Method

The RetrieveByNumber method retrieves an answer by the number specified. Only published answers are retrieved.

Syntax

[Visual Basic .NET]
Public Function RetrieveByNumber(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal AnswerNumber As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByNumber(
  CUserAuth  Caller,
  string  OrganizationId,
  string  AnswerNumber,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByNumber(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  AnswerNumber,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
AnswerNumber
Specifies the number of the answer.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in documentindex.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the answers found. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by documentindex.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAnswer proxy object
Microsoft.Crm.Platform.Proxy.CRMAnswer answer = new Microsoft.Crm.Platform.Proxy.CRMAnswer ();
answer.Credentials = System.Net.CredentialCache.DefaultCredentials;
answer.Url = strDir + "CRMAnswer.srf";

string strErrorMsg;

// A valid organization ID
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";
string num = "1";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>subjectid</column>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the answer
   string strAnswerXml = answer.RetrieveByNumber(userAuth, strOrgId, num, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}

catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAnswer Class
  • Retrieve


CRMAnswer.RetrieveByObject Method

The RetrieveByObject method retrieves the answer objects associated with the specified object (article).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal ObjectId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  string  ObjectId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  String*  ObjectId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
ObjectId
Specifies the ID of the article.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in documentindex.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the answers requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<documentindexes> + documentindex1..N + </documentindexes>

where the XML schema for each answer is described by documentindex.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAnswer proxy object
Microsoft.Crm.Platform.Proxy.CRMAnswer answer = new Microsoft.Crm.Platform.Proxy.CRMAnswer ();
answer.Credentials = System.Net.CredentialCache.DefaultCredentials;
answer.Url = strDir + "CRMAnswer.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

// A valid article ID
   string strArticleId = "{67F2977A-5FB0-4479-ADA0-520B33BA702B}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>subjectid</column>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the answer
   string strAnswerXml = answer.RetrieveByObject (userAuth, strArticleId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}

catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAnswer Class
  • Retrieve


CRMAnswer.RetrieveBySubject Method

The RetrieveBySubject method retrieves all the answers related to the specified subject.

Syntax

[Visual Basic .NET]
Public Function RetrieveBySubject(
  ByVal Caller As CUserAuth,
  ByVal SubjectId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveBySubject(
  CUserAuth  Caller,
  string  SubjectId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveBySubject(
  CUserAuth*  Caller,
  String*  SubjectId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
SubjectId
Specifies the ID of the subject.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in documentindex.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the answers requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<documentindexes> + documentindex1..N + </documentindexes>

where the XML schema for each answer is described by documentindex.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAnswer proxy object
Microsoft.Crm.Platform.Proxy.CRMAnswer answer = new Microsoft.Crm.Platform.Proxy.CRMAnswer ();
answer.Credentials = System.Net.CredentialCache.DefaultCredentials;
answer.Url = strDir + "CRMAnswer.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // A valid subject ID
   string strSubjectId = "{E4735CBC-A539-4B8C-B848-0C3C94E19BA6}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>subjectid</column>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the answer
   string strAnswerXml = answer.RetrieveBySubject(userAuth, strSubjectId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}

catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAnswer Class
  • Retrieve


CRMAnswer.SearchByBody Method

The SearchByBody method executes a full-text search by body.

Syntax

[Visual Basic .NET]
Public Function SearchByBody(
  ByVal Caller As CUserAuth,
  ByVal SearchText As String,
  ByVal SubjectId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string SearchByBody(
  CUserAuth  Caller,
  string  SearchText,
  string  SubjectId,
  string  ColumnSetXML
);
[C++]
public: String* SearchByBody(
  CUserAuth*  Caller,
  String*  SearchText,
  String*  SubjectId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
SearchText
Specifies the text to search for.
SubjectId
Specifies the ID of the subject.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in documentindex.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the answers requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<documentindexes> + documentindex1..N + </documentindexes>

where the XML schema for each answer is described by documentindex.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAnswer proxy object
Microsoft.Crm.Platform.Proxy.CRMAnswer answer = new Microsoft.Crm.Platform.Proxy.CRMAnswer ();
answer.Credentials = System.Net.CredentialCache.DefaultCredentials;
answer.Url = strDir + "CRMAnswer.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // A valid subject ID
   string strSubjectId = "{E4735CBC-A539-4B8C-B848-0C3C94E19BA6}";
   string strSearch = "title";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>subjectid</column>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the answer
   string strAnswerXml = answer.SearchByBody (userAuth, strSearch, strSubjectId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}

catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAnswer Class
  • SearchByKeywords
  • SearchByTitle


CRMAnswer.SearchByKeywords Method

The SearchByKeywords method executes a full-text search by keywords.

Syntax

[Visual Basic .NET]
Public Function SearchByKeywords(
  ByVal Caller As CUserAuth,
  ByVal SearchText As String,
  ByVal SubjectId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string SearchByKeywords(
  CUserAuth  Caller,
  string  SearchText,
  string  SubjectId,
  string  ColumnSetXML
);
[C++]
public: String* SearchByKeywords(
  CUserAuth*  Caller,
  String*  SearchText,
  String*  SubjectId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
SearchText
Specifies the text to search for.
SubjectId
Sepcifies the ID of the subject.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in documentindex.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the answers requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<documentindexes> + documentindex1..N + </documentindexes>

where the XML schema for each answer is described by documentindex.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAnswer proxy object
Microsoft.Crm.Platform.Proxy.CRMAnswer answer = new Microsoft.Crm.Platform.Proxy.CRMAnswer ();
answer.Credentials = System.Net.CredentialCache.DefaultCredentials;
answer.Url = strDir + "CRMAnswer.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // A valid subject ID
   string strSubjectId = "{E4735CBC-A539-4B8C-B848-0C3C94E19BA6}";
   string strSearch = "test";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>subjectid</column>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the answer
   string strAnswerXml = answer.SearchByKeywords (userAuth, strSearch, strSubjectId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}

catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAnswer Class
  • SearchByBody
  • SearchByTitle


CRMAnswer.SearchByTitle Method

The SearchByTitle method executes a full-text search by title.

Syntax

[Visual Basic .NET]
Public Function SearchByTitle(
  ByVal Caller As CUserAuth,
  ByVal SearchText As String,
  ByVal SubjectId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string SearchByTitle(
  CUserAuth  Caller,
  string  SearchText,
  string  SubjectId,
  string  ColumnSetXML
);
[C++]
public: String* SearchByTitle(
  CUserAuth*  Caller,
  String*  SearchText,
  String*  SubjectId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
SearchText
Specifies the text to search for.
SubjectId
Specifies the ID of the subject.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in documentindex.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the answers requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<documentindexes> + documentindex1..N + </documentindexes>

where the XML schema for each answer is described by documentindex.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMAnswer proxy object
Microsoft.Crm.Platform.Proxy.CRMAnswer answer = new Microsoft.Crm.Platform.Proxy.CRMAnswer ();
answer.Credentials = System.Net.CredentialCache.DefaultCredentials;
answer.Url = strDir + "CRMAnswer.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // A valid subject ID
   string strSubjectId = "{E4735CBC-A539-4B8C-B848-0C3C94E19BA6}";
   string strSearch = "Title";

   // Set up the columns that you wnat to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>subjectid</column>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the answer
   string strAnswerXml = answer.SearchByTitle (userAuth, strSearch, strSubjectId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}

catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMAnswer Class
  • SearchByBody
  • SearchByKeywords


CRMArticle Class

The CRMArticle class contains methods that you can use to manage articles.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMArticle
[Visual Basic .NET]
Public Class CRMArticle
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMArticle : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMArticle: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMArticle class exposes the following methods.

Method | Description
Create | Creates a new article.
CreateAndRetrieve | Creates a new article and then retrieves it.
Delete | Deletes an article.
Publish | Sets the state of an article to Published.
Reject | Sets the state of an article to Draft.
Retrieve | Retrieves an existing article.
RetrieveByState | Retrieves all the articles with the specified state for the specified organization.
Submit | Sets the state of an article to Waiting for Approval.
UnPublish | Sets the state of an article to Draft.
Update | Updates an existing article.
UpdateAndRetrieve | Updates an existing article and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMArticle.Create Method

The Create method creates a new article.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal ArticleXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  ArticleXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  ArticleXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateArticle privilege. See CUserAuth.
ArticleXML
Specifies an XML string representing the article. The XML schema is described by kbarticle.xsd.

Return Value

Returns a String type that specifies the ID of the newly created article.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMArticle kbArticle = new Microsoft.Crm.Platform.Proxy.CRMArticle ();
kbArticle.Credentials = System.Net.CredentialCache.DefaultCredentials;
kbArticle.Url = strDir + "CRMArticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string subjectId = "{A66DCB6D-0E65-440B-B2F4-9A28EC92A7D4}";
   string templateId = "{F9920C07-EE2A-4616-A7EC-1E9D280CF535}";

   // Set up the XML string for the article
   string strXml = "<kbarticle>";
   strXml += "<title>Article 1</title>";
   strXml += "<description>A description of the article.</description>";
   strXml += "<subjectid>" + subjectId + "</subjectid>";
   strXml += "<kbarticletemplateid>" + templateId + "</kbarticletemplateid>";
   strXml += "<comments>Comments</comments>";
   strXml += "<keywords>one two three four</keywords>";
   strXml += "</kbarticle>";

   string strArticleId = kbArticle.Create(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMArticle Class
  • Update


CRMArticle.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new article and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ArticleXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  ArticleXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  ArticleXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateArticle and prvReadArticle privileges. See CUserAuth.
ArticleXML
Specifies an XML string representing the article. The XML schema is described by kbarticle.xsd.

Return Value

Returns a String type that specifies the XML data representing the new article. The XML schema is described by kbarticle.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMArticle article = new Microsoft.Crm.Platform.Proxy.CRMArticle ();
article.Credentials = System.Net.CredentialCache.DefaultCredentials;
article.Url = strDir + "CRMArticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string subjectId = "{A66DCB6D-0E65-440B-B2F4-9A28EC92A7D4}";
   string templateId = "{72D46F0C-3855-4CA2-96E9-498E9BA08665}";

   // Set up the XML string for the article
   string strXml = "<kbarticle>";
   strXml += "<title>Article 1</title>";
   strXml += "<description>A description of the article.</description>";
   strXml += "<subjectid>" + subjectId + "</subjectid>";
   strXml += "<kbarticletemplateid>" + templateId + "</kbarticletemplateid>";
   strXml += "<comments>Comments</comments>";
   strXml += "<keywords>one two three four</keywords>";
   strXml += "</kbarticle>";

   string strArticleXml = articletemplate.CreateAndRetrieve(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMArticle Class
  • UpdateAndRetrieve


CRMArticle.Delete Method

The Delete method deletes an article.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ArticleId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ArticleId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ArticleId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteArticle privilege. See CUserAuth.
ArticleId
Specifies the ID of the article to delete.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMArticle article = new Microsoft.Crm.Platform.Proxy.CRMArticle ();
article.Credentials = System.Net.CredentialCache.DefaultCredentials;
article.Url = strDir + "CRMArticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleId = "{70769894-638F-41F2-A692-E2BC7ED23557}";

   // Now delete the article
   article.Delete(userAuth, strArticleId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticle Class


CRMArticle.Publish Method

The Publish method sets the state of an article to Published.

Syntax

[Visual Basic .NET]
Public Sub Publish(
  ByVal Caller As CUserAuth,
  ByVal ArticleId As String
)
[C#]
public void Publish(
  CUserAuth  Caller,
  string  ArticleId
);
[C++]
public: void Publish(
  CUserAuth*  Caller,
  String*  ArticleId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvPublishArticle privilege. See CUserAuth.
ArticleId
Specifies the ID of the article to publish.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMArticle article = new Microsoft.Crm.Platform.Proxy.CRMArticle ();
article.Credentials = System.Net.CredentialCache.DefaultCredentials;
article.Url = strDir + "CRMArticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleId = "{70769894-638F-41F2-A692-E2BC7ED23557}";

   // Publish the article
   article.Publish(userAuth, strArticleId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticle Class


CRMArticle.Reject Method

The Reject method sets the state of an article to Draft.

Syntax

[Visual Basic .NET]
Public Sub Reject(
  ByVal Caller As CUserAuth,
  ByVal ArticleId As String
)
[C#]
public void Reject(
  CUserAuth  Caller,
  string  ArticleId
);
[C++]
public: void Reject(
  CUserAuth*  Caller,
  String*  ArticleId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteArticle privilege to perform this action. See CUserAuth.
ArticleId
Specifies the ID of the article to reject.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMArticle article = new Microsoft.Crm.Platform.Proxy.CRMArticle ();
article.Credentials = System.Net.CredentialCache.DefaultCredentials;
article.Url = strDir + "CRMArticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleId = "{70769894-638F-41F2-A692-E2BC7ED23557}";

   // Reject the article
   article.Reject (userAuth, strArticleId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticle Class


CRMArticle.Retrieve Method

The Retrieve method retrieves an existing article.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal ArticleId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  ArticleId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  ArticleId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadArticle privilege to perform this action. See CUserAuth.
ArticleId
Specifies the ID of the article to retrieve.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in kbarticle.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the article. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by kbarticle.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMArticle article = new Microsoft.Crm.Platform.Proxy.CRMArticle ();
article.Credentials = System.Net.CredentialCache.DefaultCredentials;
article.Url = strDir + "CRMArticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleId = "{70769894-638F-41F2-A692-E2BC7ED23557}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the article
   string strArticleXml = article.Retrieve(userAuth, strArticleId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticle Class
  • RetrieveByState


CRMArticle.RetrieveByState Method

The RetrieveByState method retrieves all the articles with the specified state for the specified organization.

Syntax

[Visual Basic .NET]
Public Function RetrieveByState(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal State As UInt32,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByState(
  CUserAuth  Caller,
  string  OrganizationId,
  uint  State,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByState(
  CUserAuth*  Caller,
  String*  OrganizationId,
  unsigned long  State,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadArticle privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
State
Specifies the state of article to be retrieved. See KBARTICLE_STATEColumnSetXMLSchema.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in kbarticle.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the articles retrieved. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<kbarticles> + kbarticle1..N + </kbarticles>

where the XML schema for each article is described by kbarticle.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMArticle article = new Microsoft.Crm.Platform.Proxy.CRMArticle ();
article.Credentials = System.Net.CredentialCache.DefaultCredentials;
article.Url = strDir + "CRMArticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Valid Organization ID
   string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";
   uint state = Microsoft.Crm.Platform.Types.KBARTICLE_STATE.KBAS_PUBLISHED;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the articles
   string strArticlesXml = article.RetrieveByState (userAuth, strOrgId, state, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticle Class
  • Retrieve


CRMArticle.Submit Method

The Submit method sets the state of an article to Waiting for Approval.

Syntax

[Visual Basic .NET]
Public Sub Submit(
  ByVal Caller As CUserAuth,
  ByVal ArticleId As String
)
[C#]
public void Submit(
  CUserAuth  Caller,
  string  ArticleId
);
[C++]
public: void Submit(
  CUserAuth*  Caller,
  String*  ArticleId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteArticle privilege to perform this action. See CUserAuth.
ArticleId
Specifies the ID of the article to submit.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMArticle article = new Microsoft.Crm.Platform.Proxy.CRMArticle ();
article.Credentials = System.Net.CredentialCache.DefaultCredentials;
article.Url = strDir + "CRMArticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleId = "{70769894-638F-41F2-A692-E2BC7ED23557}";

   // Submit the article
   article.Submit(userAuth, strArticleId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticle Class


CRMArticle.UnPublish Method

The UnPublish method sets the state of an article to Draft.

Syntax

[Visual Basic .NET]
Public Sub UnPublish(
  ByVal Caller As CUserAuth,
  ByVal ArticleId As String
)
[C#]
public void UnPublish(
  CUserAuth  Caller,
  string  ArticleId
);
[C++]
public: void UnPublish(
  CUserAuth*  Caller,
  String*  ArticleId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvPublishArticle privilege. See CUserAuth.
ArticleId
Specifies the ID of the article to remove from the set of published articles.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMArticle article = new Microsoft.Crm.Platform.Proxy.CRMArticle ();
article.Credentials = System.Net.CredentialCache.DefaultCredentials;
article.Url = strDir + "CRMArticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleId = "{70769894-638F-41F2-A692-E2BC7ED23557}";

   // Unpublish the article
   article.UnPublish(userAuth, strArticleId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticle Class


CRMArticle.Update Method

The Update method updates an existing article.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal ArticleId As String,
  ByVal ArticleXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  ArticleId,
  string  ArticleXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  ArticleId,
  String*  ArticleXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteArticle privilege to perform this action. See CUserAuth.
ArticleId
Specifies the ID of the article to update.
ArticleXML
Specifies an XML string representing the article. The XML schema is described by kbarticle.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMArticle article = new Microsoft.Crm.Platform.Proxy.CRMArticle ();
article.Credentials = System.Net.CredentialCache.DefaultCredentials;
article.Url = strDir + "CRMArticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleId = "{70769894-638F-41F2-A692-E2BC7ED23557}";

   // Set up XML string to update the article
   string strXml = "<kbarticle>";
   strXml += "<structurexml>new structure</structurexml>";
   strXml += "</kbarticle>";

   // Update the article
   article.Update(userAuth, strArticleId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMArticle Class
  • UpdateAndRetrieve


CRMArticle.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an existing article and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ArticleId As String,
  ByVal ArticleXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  ArticleId,
  string  ArticleXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  ArticleId,
  String*  ArticleXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteArticle and prvReadArticle privileges to perform this action. See CUserAuth.
ArticleId
Specifies the ID of the article.
ArticleXML
Specifies an XML string representing the article. The XML schema is described by kbarticle.xsd.

Return Value

Returns a String type that specifies the XML data representing the updated article. The XML schema is described by kbarticle.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMArticle article = new Microsoft.Crm.Platform.Proxy.CRMArticle ();
article.Credentials = System.Net.CredentialCache.DefaultCredentials;
article.Url = strDir + "CRMArticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleId = "{70769894-638F-41F2-A692-E2BC7ED23557}";

   // Set up XML string to update the article
   string strXml = "<kbarticle>";
   strXml += "<title>A new title</title>";
   strXml += "</kbarticle>";

   // Update and then retrieve the article
   string strArticleXml = article.UpdateAndRetrieve(userAuth, strArticleId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMArticle Class
  • Update


CRMArticleComment Class

The CRMArticleComment class contains methods that you can use to manage article comments.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMArticleComment
[Visual Basic .NET]
Public Class CRMArticleComment
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMArticleComment : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMArticleComment: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMArticleComment class exposes the following methods.

Method | Description
Create | Creates a new article comment.
CreateAndRetrieve | Creates a new article comment and then retrieves it.
Delete | Deletes an article comment.
Retrieve | Retrieves an existing article comment.
RetrieveByObject | Retrieves all article comments associated with an object (article).
Update | Updates an existing article comment.
UpdateAndRetrieve | Updates an existing article comment and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMArticleComment.Create Method

The Create method creates a new article comment.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal ArticleCommentXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  ArticleCommentXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  ArticleCommentXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateArticle privilege to perform this action. See CUserAuth.
ArticleCommentXML
Specifies an XML string containing the article comment information. The XML schema is described by kbarticlecomment.xsd.

Return Value

Returns a String type that specifies the ID of the article comment.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleComment proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleComment kbArticleComment = new Microsoft.Crm.Platform.Proxy.CRMArticleComment ();
kbArticleComment.Credentials = System.Net.CredentialCache.DefaultCredentials;
kbArticleComment.Url = strDir + "CRMArticleComment.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleId = "{03CF1041-553A-4B92-8207-98F04901ABC9}";

   // Set up the XML string for the article comment
   string strXml = "<kbarticlecomment>";
   strXml += "<kbarticleid>" + strArticleId + "</kbarticleid>";
   strXml += "<title> title 1</title>";
   strXml += "</kbarticlecomment>";

   string strArticleCommentId = kbArticleComment.Create(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMArticleComment Class
  • Update


CRMArticleComment.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new article comment and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ArticleCommentXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  ArticleCommentXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  ArticleCommentXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateArticle and prvReadArticle privileges to perform this action. See CUserAuth.
ArticleCommentXML
Specifies an XML string containing the article comment information. The XML schema is described by kbarticlecomment.xsd.

Return Value

Returns a String type that specifies the XML data containing the new article comment. The XML schema is described by kbarticlecomment.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleComment proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleComment articlecomment = new Microsoft.Crm.Platform.Proxy.CRMArticleComment ();
articlecomment.Credentials = System.Net.CredentialCache.DefaultCredentials;
articlecomment.Url = strDir + "CRMArticleComment.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleId = "{03CF1041-553A-4B92-8207-98F04901ABC9}";

   // Set up the XML string for the article comment
   string strXml = "<kbarticlecomment>";
   strXml += "<kbarticleid>" + strArticleId + "</kbarticleid>";
   strXml += "<title> title 1</title>";
   strXml += "</kbarticlecomment>";

   string strArticleCommentXml = articlecomment.CreateAndRetrieve(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMArticleComment Class
  • UpdateAndRetrieve


CRMArticleComment.Delete Method

The Delete method deletes an article comment.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ArticleCommentId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ArticleCommentId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ArticleCommentId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteArticle privilege to perform this action. See CUserAuth.
ArticleCommentId
Specifies the ID of the article comment to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleComment proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleComment articlecomment = new Microsoft.Crm.Platform.Proxy.CRMArticleComment ();
articlecomment.Credentials = System.Net.CredentialCache.DefaultCredentials;
articlecomment.Url = strDir + "CRMArticleComment.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleCommentId = "{863538A6-7C5F-40EB-8EE4-F9421A062B61}";

   // Now delete the article comment
   articlecomment.Delete(userAuth, strArticleCommentId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticleComment Class


CRMArticleComment.Retrieve Method

The Retrieve method retrieves an existing article comment.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal ArticleCommentId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  ArticleCommentId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  ArticleCommentId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadArticle privilege to perform this action. See CUserAuth.
ArticleCommentId
Specifies the ID of the article comment to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in kbarticlecomment.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the article comment retrieved. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by kbarticlecomment.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleComment proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleComment articlecomment = new Microsoft.Crm.Platform.Proxy.CRMArticleComment ();
articlecomment.Credentials = System.Net.CredentialCache.DefaultCredentials;
articlecomment.Url = strDir + "CRMArticleComment.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleCommentId = "{863538A6-7C5F-40EB-8EE4-F9421A062B61}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "<column>kbarticleid</column>";
   strColumnSetXml += "<column>commenttext</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the article comment
   string strArticleCommentXml = articlecomment.Retrieve(userAuth, strArticleCommentId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticleComment Class
  • RetrieveByObject


CRMArticleComment.RetrieveByObject Method

The RetrieveByObject method retrieves all article comments associated with an object (article).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadArticle privilege to perform this action. See CUserAuth.
Object
Specifies the object (article) for which to retrieve associated article comments. See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in kbarticlecomment.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of article comments retrieved. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<kbarticlecomments> + kbarticlecomment1..N + </kbarticlecomments>

where the XML schema for each article comment is described by kbarticlecomment.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleComment proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleComment articlecomment = new Microsoft.Crm.Platform.Proxy.CRMArticleComment ();
articlecomment.Credentials = System.Net.CredentialCache.DefaultCredentials;
articlecomment.Url = strDir + "CRMArticleComment.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleId = "{03CF1041-553A-4B92-8207-98F04901ABC9}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "<column>kbarticleid</column>";
   strColumnSetXml += "<column>commenttext</column>";
   strColumnSetXml += "</columnset>";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strArticleId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otKbArticle;

   // Retrieve the article comments associated with the object
   string strResultsXml = articlecomment.RetrieveByObject(userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticleComment Class
  • Retrieve


CRMArticleComment.Update Method

The Update method updates an existing article comment.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal ArticleCommentId As String,
  ByVal ArticleCommentXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  ArticleCommentId,
  string  ArticleCommentXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  ArticleCommentId,
  String*  ArticleCommentXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteArticle privilege to perform this action. See CUserAuth.
ArticleCommentId
Specifies the ID of the article comment to be updated.
ArticleCommentXML
Specifies an XML string containing the article comment information. The XML schema is described by kbarticlecomment.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleComment proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleComment articlecomment = new Microsoft.Crm.Platform.Proxy.CRMArticleComment ();
articlecomment.Credentials = System.Net.CredentialCache.DefaultCredentials;
articlecomment.Url = strDir + "CRMArticleComment.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleCommentId = "{863538A6-7C5F-40EB-8EE4-F9421A062B61}";

   // Set up the XML string for the article comment
   string strXml = "<kbarticlecomment>";
   strXml += "<title>title 2</title>";
   strXml += "<commenttext>this is article is about ..</commenttext>";
   strXml += "</kbarticlecomment>";

   articlecomment.Update(userAuth, strArticleCommentId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMArticleComment Class
  • UpdateAndRetrieve


CRMArticleComment.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an existing article comment and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ArticleCommentId As String,
  ByVal ArticleCommentXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  ArticleCommentId,
  string  ArticleCommentXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  ArticleCommentId,
  String*  ArticleCommentXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteArticle and prvReadArticle privileges to perform this action. See CUserAuth.
ArticleCommentId
Specifies the ID of the article comment to be updated.
ArticleCommentXML
Specifies an XML string containing the article comment information. The XML schema is described by kbarticlecomment.xsd.

Return Value

Returns a String type that specifies the XML data containing the new article comment. The XML schema is described by kbarticlecomment.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleComment proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleComment articlecomment = new Microsoft.Crm.Platform.Proxy.CRMArticleComment ();
articlecomment.Credentials = System.Net.CredentialCache.DefaultCredentials;
articlecomment.Url = strDir + "CRMArticleComment.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strArticleCommentId = "{863538A6-7C5F-40EB-8EE4-F9421A062B61}";

   // Set up the XML string for the article comment
   string strXml = "<kbarticlecomment>";
   strXml += "<title>title 2</title>";
   strXml += "<commenttext>This is article is about ..</commenttext>";
   strXml += "</kbarticlecomment>";

   // Update the article comment, and then retrieve it
   string strResultsXml = articlecomment.UpdateAndRetrieve(userAuth, strArticleCommentId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMArticleComment Class
  • Update


CRMArticleTemplate Class

The CRMArticleTemplate class contains methods that you can use to manage article templates.

You can create a structure for the article template that is meaningful for the application you are creating. Note that these custom article templates do not work with the Microsoft CRM application, which uses a proprietary article template format.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMArticleTemplate
[Visual Basic .NET]
Public Class CRMArticleTemplate
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMArticleTemplate : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMArticleTemplate: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMArticleTemplate class exposes the following methods.

Method | Description
Create | Creates a new article template.
CreateAndRetrieve | Creates a new article template and then retrieves it.
Delete | Deletes an article template.
Retrieve | Retrieves an existing article template.
RetrieveByOrganization | Retrieves all the active article templates for an organization.
Update | Updates an existing article template.
UpdateAndRetrieve | Updates an existing article template and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMArticleTemplate.Create Method

The Create method creates a new article template.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal ArticleTemplateXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  ArticleTemplateXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  ArticleTemplateXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateArticleTemplate privilege to perform this action. See CUserAuth.
ArticleTemplateXML
Specifies an XML string representing the article template. The XML schema is described by kbarticletemplate.xsd.

Return Value

Returns a String type that specifies the ID of the newly created article template.

Remarks

Create a value for the structure field that is meaningful for your application. Please note that these article templates do not work with the Microsoft CRM application, which uses a proprietary article template format.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleTemplate kbArticleTemplate = new Microsoft.Crm.Platform.Proxy.CRMArticleTemplate ();
kbArticleTemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
kbArticleTemplate.Url = strDir + "CRMArticleTemplate.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the article template
   string strXml = "<kbarticletemplate>";
   strXml += "<title>Article Template 1</title>";
   strXml += "<description>A description of the template.</description>";
   strXml += "<structurexml>some structure</structurexml>";
   strXml += "<formatxml>some format</formatxml>";
   strXml += "</kbarticletemplate>";

   string strArticleTemplateId = kbArticleTemplate.Create(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMArticleTemplate Class
  • Update


CRMArticleTemplate.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new article template and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ArticleTemplateXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  ArticleTemplateXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  ArticleTemplateXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateArticleTemplate and prvReadArticleTemplate privileges to perform this action. See CUserAuth.
ArticleTemplateXML
Specifies an XML string representing the article template. The XML schema is described by kbarticletemplate.xsd.

Return Value

Returns a String type that specifies the XML data representing the new article template. The XML schema is described by kbarticletemplate.xsd.

Remarks

Create a value for the structure field that is meaningful for your application. Note that these article templates do not work with the Microsoft CRM application, which uses a proprietary article template format.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleTemplate articletemplate = new Microsoft.Crm.Platform.Proxy.CRMArticleTemplate ();
articletemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
articletemplate.Url = strDir + "CRMArticleTemplate.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the article template
   string strXml = "<kbarticletemplate>";
   strXml += "<title>Article Template 2</title>";
   strXml += "<description>A description of the template.</description>";
   strXml += "<structurexml>some structure</structurexml>";
   strXml += "<formatxml>some format</formatxml>";
   strXml += "</kbarticletemplate>";

   string strArticleTemplateXml = articletemplate.CreateAndRetrieve(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMArticleTemplate Class
  • UpdateAndRetrieve


CRMArticleTemplate.Delete Method

The Delete method deletes an article template.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ArticleTemplateId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ArticleTemplateId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ArticleTemplateId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteArticleTemplate privilege to perform this action. See CUserAuth.
ArticleTemplateId
Specifies the ID of the article template to delete.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleTemplate articletemplate = new Microsoft.Crm.Platform.Proxy.CRMArticleTemplate ();
articletemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
articletemplate.Url = strDir + "CRMArticleTemplate.srf";

string strErrorMsg;
string strArticleTemplateId = "{72D46F0C-3855-4CA2-96E9-498E9BA08665}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the article template
   articletemplate.Delete(userAuth, strArticleTemplateId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticleTemplate Class


CRMArticleTemplate.Retrieve Method

The Retrieve method retrieves an existing article template.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal ArticleTemplateId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  ArticleTemplateId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  ArticleTemplateId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadArticleTemplate privilege to perform this action. See CUserAuth.
ArticleTemplateId
Specifies the ID of the article template.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in kbarticletemplate.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the article template. The fields that are returned for each team depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by kbarticletemplate.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleTemplate articletemplate = new Microsoft.Crm.Platform.Proxy.CRMArticleTemplate ();
articletemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
articletemplate.Url = strDir + "CRMArticleTemplate.srf";

string strErrorMsg;
string strArticleTemplateId = "{72D46F0C-3855-4CA2-96E9-498E9BA08665}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the article template
   string strArticleTemplateXml = articletemplate.Retrieve(userAuth, strArticleTemplateId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticleTemplate Class
  • RetrieveByOrganization


CRMArticleTemplate.RetrieveByOrganization Method

The RetrieveByOrganization method retrieves all the active article templates of an organization.

Syntax

[Visual Basic .NET]
Public Function RetrieveByOrganization(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByOrganization(
  CUserAuth  Caller,
  string  OrganizationId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByOrganization(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadArticleTemplate privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in kbarticletemplate.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the article template. The fields that are returned for each team depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<kbarticletemplates> + kbarticletemplate1..N + </kbarticletemplates>

where the XML schema for each article template is described by kbarticletemplate.xsd.

A sample output looks like:

<kbarticletemplates>
      <kbarticletemplate>
         <title>Title 1</title>
         <title>Description 1</title>
      </kbarticletemplate>
      <kbarticletemplate>
         <title>Title 2</title>
         <title>Description 2</title>
      </kbarticletemplate>
</kbarticletemplates>

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleTemplate articletemplate = new Microsoft.Crm.Platform.Proxy.CRMArticleTemplate ();
articletemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
articletemplate.Url = strDir + "CRMArticleTemplate.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}"
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the article template
   string strArticleTemplatesXml = articletemplate.RetrieveByOrganization(userAuth, strOrgID, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMArticleTemplate Class
  • Retrieve


CRMArticleTemplate.Update Method

The Update method updates an existing article template.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal ArticleTemplateId As String,
  ByVal ArticleTemplateXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  ArticleTemplateId,
  string  ArticleTemplateXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  ArticleTemplateId,
  String*  ArticleTemplateXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteArticleTemplate privilege to perform this action. See CUserAuth.
ArticleTemplateId
Specifies the ID of the article template to update.
ArticleTemplateXML
Specifies an XML string representing the article template. The XML schema is described by kbarticletemplate.xsd.

Return Value

No return value.

Remarks

Create a value for the structure field that is meaningful for your application. Note that these article templates do not work with the Microsoft CRM application, which uses a proprietary article template format.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleTemplate articletemplate = new Microsoft.Crm.Platform.Proxy.CRMArticleTemplate ();
articletemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
articletemplate.Url = strDir + "CRMArticleTemplate.srf";

string strErrorMsg;
string strArticleTemplateId = "{72D46F0C-3855-4CA2-96E9-498E9BA08665}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the article template
   string strXml = "<kbarticletemplate>";
   strXml += "<structurexml>new structure</structurexml>";
   strXml += "</kbarticletemplate>";

   articletemplate.Update(userAuth, strArticleTemplateId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMArticleTemplate Class
  • UpdateAndRetrieve


CRMArticleTemplate.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an existing article template and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ArticleTemplateId As String,
  ByVal ArticleTemplateXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  ArticleTemplateId,
  string  ArticleTemplateXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  ArticleTemplateId,
  String*  ArticleTemplateXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteArticleTemplate and prvReadArticleTemplate privileges to perform this action. See CUserAuth.
ArticleTemplateId
Specifies the ID of the article template to update.
ArticleTemplateXML
Specifies an XML string representing the article template. The XML schema is described by kbarticletemplate.xsd.

Return Value

Returns a String type that specifies the XML data representing the new article template. The XML schema is described by kbarticletemplate.xsd.

Remarks

Create a value for the structure field that is meaningful for your application. Note that these article templates do not work with the Microsoft CRM application, which uses a proprietary article template format.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMArticleTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMArticleTemplate articletemplate = new Microsoft.Crm.Platform.Proxy.CRMArticleTemplate ();
articletemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
articletemplate.Url = strDir + "CRMArticleTemplate.srf";

string strErrorMsg;
string strArticleTemplateId = "{72D46F0C-3855-4CA2-96E9-498E9BA08665}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the article template
   string strXml = "<kbarticletemplate>";
   strXml += "<title>A new title</title>";
   strXml += "</kbarticletemplate>";

   // Update the article template, and then retrieve it
   string strResultsXml = articletemplate.UpdateAndRetrieve(userAuth, strArticleTemplateId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMArticleTemplate Class
  • Update


CRMCompetitor Class

The CRMCompetitor class contains methods that you can use to manage competitors.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMCompetitor
[Visual Basic .NET]
Public Class CRMCompetitor
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMCompetitor : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMCompetitor: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMCompetitor class exposes the following methods.

Method | Description
Create | Creates a competitor.
CreateAndRetrieve | Creates a competitor and then retrieves it.
Delete | Deletes a competitor.
Retrieve | Retrieves a competitor.
RetrieveByObject | Retrieves all the competitors associated with an object (product).
RetrieveByOrganization | Retrieves all the competitors for an organization.
Update | Updates an existing competitor.
UpdateAndRetrieve | Updates an existing competitor and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMCompetitor.Create Method

The Create method creates a competitor.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal CompetitorXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  CompetitorXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  CompetitorXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateCompetitor privilege to perform this action. See CUserAuth.
CompetitorXML
Specifies an XML string representing a competitor. The XML schema is described by competitor.xsd.

Return Value

Returns a String type that specifies the ID of the newly created competitor.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCompetitor proxy object
Microsoft.Crm.Platform.Proxy.CRMCompetitor competitor = new Microsoft.Crm.Platform.Proxy.CRMCompetitor ();
competitor.Credentials = System.Net.CredentialCache.DefaultCredentials;
competitor.Url = strDir + "CRMCompetitor.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the competitor
   string strCompetitorXml = "<competitor>";
   strCompetitorXml += "<name>Adventure Works</name>";
   strCompetitorXml += "<websiteurl>www.adventure-works.com</websiteurl>";
   strCompetitorXml += "</competitor>";

   string strCompetitorId = competitor.Create(userAuth, strCompetitorXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMCompetitor Class
  • Update


CRMCompetitor.CreateAndRetrieve Method

The CreateAndRetrieve method creates a competitor and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InCompetitorXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InCompetitorXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InCompetitorXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateCompetitor and prvReadCompetitor privileges to perform this action. See CUserAuth.
InCompetitorXML
Specifies an XML string representing a competitor. The XML schema is described by competitor.xsd.

Return Value

Returns a String type that specifies the XML data representing the new competitor. The XML schema is described by competitor.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCompetitor proxy object
Microsoft.Crm.Platform.Proxy.CRMCompetitor competitor = new Microsoft.Crm.Platform.Proxy.CRMCompetitor ();
competitor.Credentials = System.Net.CredentialCache.DefaultCredentials;
competitor.Url = strDir + "CRMCompetitor.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the SML string for the competitor
   string strCompetitorXml = "<competitor>";
   strCompetitorXml += "<name>Adventure Works</name>";
   strCompetitorXml += "<websiteurl>www.adventure-works.com</websiteurl>";
   strCompetitorXml += "</competitor>";

   string strResultsXml = competitor.CreateAndRetrieve(userAuth, strCompetitorXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMCompetitor Class
  • UpdateAndRetrieve


CRMCompetitor.Delete Method

The Delete method permanently deletes a competitor.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal CompetitorId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  CompetitorId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  CompetitorId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteCompetitor privilege to perform this action. See CUserAuth.
CompetitorId
Specifies the ID of the competitor to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCompetitor proxy object
Microsoft.Crm.Platform.Proxy.CRMCompetitor competitor = new Microsoft.Crm.Platform.Proxy.CRMCompetitor ();
competitor.Credentials = System.Net.CredentialCache.DefaultCredentials;
competitor.Url = strDir + "CRMCompetitor.srf";

string strErrorMsg;
string strCompetitorId = "{FC4D3D50-C934-4AB9-BDB3-6DE223A5F686}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the competitor
   competitor.Delete(userAuth, strCompetitorId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMCompetitor Class


CRMCompetitor.Retrieve Method

The Retrieve method retrieves a competitor.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal CompetitorId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  CompetitorId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  CompetitorId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadCompetitor privilege to perform this action. See CUserAuth.
CompetitorId
Specifies the ID of the competitor to retrieve.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in competitor.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing a competitor. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by competitor.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCompetitor proxy object
Microsoft.Crm.Platform.Proxy.CRMCompetitor competitor = new Microsoft.Crm.Platform.Proxy.CRMCompetitor ();
competitor.Credentials = System.Net.CredentialCache.DefaultCredentials;
competitor.Url = strDir + "CRMCompetitor.srf";

string strErrorMsg;
string strCompetitorId = "{FC4D3D50-C934-4AB9-BDB3-6DE223A5F686}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>strengths</column>";
   strColumnSetXml += "<column>weaknesses</column>";
   strColumnSetXml += "<column>opportunities</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the competitor
   string strCompetitorXml = competitor.Retrieve(userAuth, strCompetitorId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMCompetitor Class
  • RetrieveByOrganization


CRMCompetitor.RetrieveByObject Method

The RetrieveByObject method retrieves all the competitors associated with an object (product).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadCompetitor privilege to perform this action. See CUserAuth.
Object
Specifies the linked object (product). See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in competitor.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of competitors retrieved. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<competitors> + competitor1..N + </competitors>

where the XML schema for each competitor is described by competitor.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCompetitor proxy object
Microsoft.Crm.Platform.Proxy.CRMCompetitor competitor = new Microsoft.Crm.Platform.Proxy.CRMCompetitor ();
competitor.Credentials = System.Net.CredentialCache.DefaultCredentials;
competitor.Url = strDir + "CRMCompetitor.srf";

string strErrorMsg;
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strProductId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otProduct;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>strengths</column>";
   strColumnSetXml += "<column>weaknesses</column>";
   strColumnSetXml += "<column>opportunities</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve all the competitors for this product
   string strResultsXml = competitor.RetrieveByObject(userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMCompetitor Class
  • Retrieve


CRMCompetitor.RetrieveByOrganization Method

The RetrieveByOrganization method retrieves all the competitors of an organization.

Syntax

[Visual Basic .NET]
Public Function RetrieveByOrganization(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByOrganization(
  CUserAuth  Caller,
  string  OrganizationId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByOrganization(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadCompetitor privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in competitor.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of competitors requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<competitors> + competitor1..N + </competitors>

where the XML schema for each competitor is described by competitor.xsd.

A sample output looks like:

<competitors>
    <competitor>
        <competitorid>{FAB242EC-E054-45ED-ABA8-1C63439DD7A2}</competitorid>
        <name>Test Competitor</name>
    </competitor>
</competitors>

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCompetitor proxy object
Microsoft.Crm.Platform.Proxy.CRMCompetitor competitor = new Microsoft.Crm.Platform.Proxy.CRMCompetitor ();
competitor.Credentials = System.Net.CredentialCache.DefaultCredentials;
competitor.Url = strDir + "CRMCompetitor.srf";

string strErrorMsg;
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>strengths</column>";
   strColumnSetXml += "<column>weaknesses</column>";
   strColumnSetXml += "<column>opportunities</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the competitors for the organization
   string strCompetitorsXml = competitor.RetrieveByOrganization(userAuth, strOrgID, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMCompetitor Class
  • Retrieve


CRMCompetitor.Update Method

The Update method updates an existing competitor.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal CompetitorId As String,
  ByVal CompetitorXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  CompetitorId,
  string  CompetitorXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  CompetitorId,
  String*  CompetitorXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteCompetitor privilege to perform this action. See CUserAuth.
CompetitorId
Specifies the ID of the competitor to update.
CompetitorXML
Specifies an XML string representing a competitor. The XML schema is described by competitor.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCompetitor proxy object
Microsoft.Crm.Platform.Proxy.CRMCompetitor competitor = new Microsoft.Crm.Platform.Proxy.CRMCompetitor ();
competitor.Credentials = System.Net.CredentialCache.DefaultCredentials;
competitor.Url = strDir + "CRMCompetitor.srf";

string strErrorMsg;
string strCompetitorId = "{FC4D3D50-C934-4AB9-BDB3-6DE223A5F686}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the competitor
   string strXml = "<competitor>";
   strXml += "<strengths>They have many different models.</strengths>";
   strXml += "<weaknesses>Their products are of poor quality.</weaknesses>";
   strXml += "<opportunities>We can market our superior quality.</opportunities>";
   strXml += "</competitor>";

   competitor.Update(userAuth, strCompetitorId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMCompetitor Class
  • UpdateAndRetrieve


CRMCompetitor.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an existing competitor and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal CompetitorId As String,
  ByVal InCompetitorXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  CompetitorId,
  string  InCompetitorXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  CompetitorId,
  String*  InCompetitorXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteCompetitor and prvReadCompetitor privileges to perform this action. See CUserAuth.
CompetitorId
Specifies the ID of the competitor to update.
InCompetitorXML
Specifies an XML string representing a competitor. The XML schema is described by competitor.xsd.

Return Value

Returns a String type that specifies the XML data representing a competitor. The XML schema is described by competitor.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCompetitor proxy object
Microsoft.Crm.Platform.Proxy.CRMCompetitor competitor = new Microsoft.Crm.Platform.Proxy.CRMCompetitor ();
competitor.Credentials = System.Net.CredentialCache.DefaultCredentials;
competitor.Url = strDir + "CRMCompetitor.srf";

string strErrorMsg;
string strCompetitorId = "{FC4D3D50-C934-4AB9-BDB3-6DE223A5F686}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the competitor
   string strXml = "<competitor>";
   strXml += "<strengths>They have many different models.</strengths>";
   strXml += "<weaknesses>Their products are of poor quality.</weaknesses>";
   strXml += "<opportunities>We can market our superior quality.</opportunities>";
   strXml += "</competitor>";

   string strCompetitorXml = competitor.UpdateAndRetrieve(userAuth, strCompetitorId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMCompetitor Class
  • Update


CRMContact Class

The CRMContact class contains methods that you can use to manage contacts.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMContact
[Visual Basic .NET]
Public Class CRMContact
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMContact : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMContact: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMContact class exposes the following methods.

Method | Description
Activate | Sets the state of a contact to Active.
Assign | Assigns a contact to another security principal.
BulkRetrieve | Retrieves multiple contacts by ID.
Create | Creates a new contact record.
CreateAndRetrieve | Creates a new contact record and then retrieves it.
Deactivate | Sets the state of a contact to Inactive.
Delete | Deletes a contact and all its child objects.
GrantAccess | Grants access to a contact.
MakePrivate | Makes a contact private.
MakePublic | Makes a contact public.
ModifyAccess | Replaces the access rights on the contact for the specified security principal.
Retrieve | Retrieves a contact.
RetrieveByObject | Retrieves all the contacts associated with the specified object (lead or opportunity).
RetrieveByPrincipal | Retrieves all the contacts owned by the specified security principal.
RetrievePrincipalAccess | Retrieves the access the specified security principal has to a contact.
RetrieveSharedPrincipals | Retrieves a list of security principals (users or teams) with which this contact is shared.
RetrieveSharedPrincipalsAndAccess | Retrieves all the security principals (users or teams) that have access to a contact, along with what access they have.
RetrieveSubLeads | Retrieves the child leads for the specified contact.
RetrieveSubOpportunities | Retrieves the child opportunities for the specified contact.
RevokeAccess | Revokes access for the specified security principal for a contact.
Update | Updates a contact.
UpdateAndRetrieve | Updates a contact and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMContact.Activate Method

The Activate method sets the state of a contact to Active.

Syntax

[Visual Basic .NET]
Public Sub Activate(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal Status As Integer
)
[C#]
public void Activate(
  CUserAuth  Caller,
  string  ContactId,
  int  Status
);
[C++]
public: void Activate(
  CUserAuth*  Caller,
  String*  ContactId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContact privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact to activate.
Status
Specifies the status of the contact. You can use this parameter to specify application status. This field corresponds to Status Reason in the Microsoft CRM application. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Deactivate this contact
   contact.Deactivate(userAuth, strContactId, -1);

   // Activate this contact
   contact.Activate(userAuth, strContactId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class


CRMContact.Assign Method

The Assign method assigns the contact to a security principal (user or team). (See Remarks.) This method also applies to the parent object and associated objects that have the same owner as the parent object. Therefore when you assign the parent object to a new owner, only the associated objects that have the same owner as the parent object are assigned. In addition, when an object is assigned to a new owner, it is shared with the previous owner with full rights. Either the new owner or the previous owner can remove the relationship or lower the level of privileges the previous owner had on the object.

Syntax

[Visual Basic .NET]
Public Sub Assign(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal Assignee As CSecurityPrincipal
)
[C#]
public void Assign(
  CUserAuth  Caller,
  string  ContactId,
  CSecurityPrincipal  Assignee
);
[C++]
public: void Assign(
  CUserAuth*  Caller,
  String*  ContactId,
  CSecurityPrincipal*  Assignee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignContact privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact to assign.
Assignee
Specifies the team or user to which the account is to be assigned. See CSecurityPrincipal.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not support business-object assignment to teams. Therefore, any solutions built by using this method are not supported by the Microsoft CRM application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the contact to the user
   contact.Assign(userAuth, strContactId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class


CRMContact.BulkRetrieve Method

The BulkRetrieve method retrieves multiple contacts by ID.

Syntax

[Visual Basic .NET]
Public Function BulkRetrieve(
  ByVal Caller As CUserAuth,
  ByVal Ids As String(),
  ByVal ColumnSet As String
) As String
[C#]
public string BulkRetrieve(
  CUserAuth  Caller,
  string[]  Ids,
  string  ColumnSet
);
[C++]
public: String* BulkRetrieve(
  CUserAuth*  Caller,
  String*  Ids __gc[],
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContact privilege to perform this action. See CUserAuth.
Ids
Specifies an array of IDs of contacts to retrieve.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contact.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested contacts. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<contacts> + contact1..N + </contacts>

where the XML schema for each contact is described by contact.xsd.

Remarks

The array of IDs passed in must not have any empty elements.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strContactId2 = "{72D46F0C-3855-4CA2-96E9-498E9BA08665}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string[] ids = new string[2];
   ids[0] = strContactId;
   ids[1] = strContactId2;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>firstname</column>";
   strColumnSetXml += "<column>lastname</column>";
   strColumnSetXml += "<column>emailaddress1</column>";
   strColumnSetXml += "</columnset>";

   // Now do a bulk retrieve
   string strResultsXml = contact.BulkRetrieve(userAuth, ids, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class


CRMContact.Create Method

The Create method creates a new contact record.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal Contact As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  Contact
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  Contact
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateContact privilege to perform this action. See CUserAuth.
Contact
Specifies an XML string describing the new contact. See Remarks. The XML schema is described by contact.xsd.

Return Value

Returns a String type that specifies the ID of the newly created contact.

Remarks

Note that accountid and parentcontactid both cannot be supplied in the XML string.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the new contact
   string strContactXml = "<contact>";
   strContactXml += "<firstname>Name</firstname><lastname>One</lastname><donotemail>0</donotemail>";
   strContactXml += "<donotpostalmail>1</donotpostalmail>";
   strContactXml += "<department>Department Name</department>";
   strContactXml += "<donotfax>1</donotfax>";
   strContactXml += "<accountid>" + strAccountId;
   strContactXml += "</accountid>";
   strContactXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strContactXml += userAuth.UserId + "</ownerid>";
   strContactXml += "</contact>";

   string strContactId = contact.Create(userAuth, strContactXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMContact Class
  • Update


CRMContact.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new contact record and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InContactXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InContactXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InContactXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateContact and prvReadContact privileges to perform this action. See CUserAuth.
InContactXml
Specifies an XML string representing a contact. The XML schema is described by contact.xsd.

Return Value

Returns a String type that specifies the XML data representing the new competitor. The XML schema is described by contact.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the new contact
   string strContactXml = "<contact>";
   strContactXml += "<firstname>Name</firstname><lastname>One</lastname><donotemail>0</donotemail>";
   strContactXml += "<donotpostalmail>1</donotpostalmail>";
   strContactXml += "<department>Department Name</department>";
   strContactXml += "<donotfax>1</donotfax>";
   strContactXml += "<accountid>" + strAccountId;
   strContactXml += "</accountid>";
   strContactXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strContactXml += userAuth.UserId + "</ownerid>";
   strContactXml += "</contact>";

   string strNewContactXml = contact.CreateAndRetrieve(userAuth, strContactXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMContact Class
  • UpdateAndRetrieve


CRMContact.Deactivate Method

The Deactivate method sets the state of a contact to Inactive.

Syntax

[Visual Basic .NET]
Public Sub Deactivate(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal Status As Integer
)
[C#]
public void Deactivate(
  CUserAuth  Caller,
  string  ContactId,
  int  Status
);
[C++]
public: void Deactivate(
  CUserAuth*  Caller,
  String*  ContactId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContact privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact to deactivate.
Status
Specifies the status of the contact. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Deactivate this contact
   contact.Deactivate(userAuth, strContactId, -1);

   // Activate this contact
   contact.Activate(userAuth, strContactId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class


CRMContact.Delete Method

The Delete method deletes a contact. When Delete is called on a contact, all child objects of the contact are also deleted. If the caller does not have the DELETE privilege for any of these child objects, then the entire deletion fails.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ContactId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ContactId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteContact privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact to delete.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the contact
   contact.Delete(userAuth, strContactId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class


CRMContact.GrantAccess Method

The GrantAccess method grants a user or team access to the specified contact. This method also applies to all child objects of the contact. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the contact. In this case, only the lack of privileges for a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub GrantAccess(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void GrantAccess(
  CUserAuth  Caller,
  string  ContactId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void GrantAccess(
  CUserAuth*  Caller,
  String*  ContactId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareContact privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact.
Rights
Specifies the set of rights to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or user that is to be granted access to the contact. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Share the contact with the user
   contact.GrantAccess(userAuth, strContactId, rights, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class


CRMContact.MakePrivate Method

The MakePrivate method makes the contact unavailable to anyone except the owner and the users that share the object. Only the owner of a contact can make it private. By default, all objects are public. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub MakePrivate(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String
)
[C#]
public void MakePrivate(
  CUserAuth  Caller,
  string  ContactId
);
[C++]
public: void MakePrivate(
  CUserAuth*  Caller,
  String*  ContactId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContact privilege and must be the contact owner to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact to make private.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if you make an object private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   contact.MakePrivate(userAuth, strContactId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class
  • MakePublic


CRMContact.MakePublic Method

The MakePublic method makes a contact available to all users. Only the owner of a contact can make it public. By default, all objects are public. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub MakePublic(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String
)
[C#]
public void MakePublic(
  CUserAuth  Caller,
  string  ContactId
);
[C++]
public: void MakePublic(
  CUserAuth*  Caller,
  String*  ContactId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContact privilege and must be the contact owner to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact to make public.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if you make an object private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   contact.MakePublic(userAuth, strContactId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class
  • MakePrivate


CRMContact.ModifyAccess Method

The ModifyAccess method replaces the access rights on the contact for the specified security principal. This method also applies to all child objects of the contact. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the contact. In this case, only the lack of privileges to a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub ModifyAccess(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)[C#]
public void ModifyAccess(
  CUserAuth  Caller,
  string  ContactId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void ModifyAccess(
  CUserAuth*  Caller,
  String*  ContactId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvShareContact privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact.
Rights
Specifies the set of rights to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or user that is to be granted access. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Modify access to this contact
   contact.ModifyAccess(userAuth, strContactId, rights, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class


CRMContact.Retrieve Method

The Retrieve method retrieves a contact.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  ContactId,
  string  ColumnSet
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  ContactId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContact privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact to retrieve.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contact.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested contact information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by contact.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

      // Retrieve the contact. Passing in a null string for ColumnSet retrieves all columns
      string strContactXml = contact.Retrieve(userAuth, strContactId, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class
  • RetrieveByObject
  • RetrieveByPrincipal
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipals
  • RetrieveSharedPrincipalsAndAccess
  • RetrieveSubLeads
  • RetrieveSubOpportunities


CRMContact.RetrieveByObject Method

The RetrieveByObject method retrieves contacts associated with the specified object (lead or opportunity).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContact privilege to perform this action. See CUserAuth.
Object
Specifies the object (lead or opportunity) to search for. See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contact.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies XML data representing the set of contacts requrested. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<contacts> + contact1..N + </contacts>

where the XML schema for each contact is described by contact.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string LeadId = "{CBF74720-0E3C-43D0-A8C5-CF2D77117F5B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create an object name structure for the lead
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strLeadId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otLead;

   // Retrieve all the contacts for the specified object
   string strContactsXml = contact.RetrieveByObject(userAuth, objName, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class
  • Retrieve


CRMContact.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves all the contacts owned by a security principal (user or team).

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal Principal As CSecurityPrincipal,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  Principal,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  Principal,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContact privilege to perform this action. See CUserAuth.
Principal
Specifies the security principal whose contacts you want to retrieve. See CSecurityPrincipal.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contact.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies XML data representing the set of contacts requested. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<contacts> + contact1..N + </contacts>

where the XML schema for each contact is described by contact.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>contactid</column>";
   strColumnSetXml += "<column>lastname</column>";
   strColumnSetXml += "</columnset>";

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve all the contacts for the specified security principal
   string strContactsXml = contact.RetrieveByPrincipal(userAuth, securityPrincipal, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class
  • Retrieve


CRMContact.RetrievePrincipalAccess Method

The RetrievePrincipalAccess method retrieves the access privileges the security principal (user or team) has to the specified contact.

Syntax

[Visual Basic .NET]
Public Function RetrievePrincipalAccess(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal Principal As CSecurityPrincipal
) As UInt32
[C#]
public uint RetrievePrincipalAccess(
  CUserAuth  Caller,
  string  ContactId,
  CSecurityPrincipal  Principal
);
[C++]
public: unsigned long RetrievePrincipalAccess(
  CUserAuth*  Caller,
  String*  ContactId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContact privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact.
Principal
Specifies the user or team to find for the contact. See CSecurityPrincipal.

Return Value

Returns a UInt32 type that specifies the rights the security principal holds for the contact. See ACCESSRIGHTS.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve the rights for the specified security principal
   uint rights = contact.RetrievePrincipalAccess(userAuth, strContactId, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class
  • Retrieve


CRMContact.RetrieveSharedPrincipals Method

The RetrieveSharedPrincipals method returns a list of security principals (users or teams) with which this contact is shared.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipals(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal Rights As UInt32
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipals(
  CUserAuth  Caller,
  string  ContactId,
  uint  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipals(
  CUserAuth*  Caller,
  String*  ContactId,
  unsigned long  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContact privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact.
Rights
Specifies the set of rights in which you are interested. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies an array of security principals (users or teams). See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] principals ;

   // Retrieve the principals that share this contact
   principals = contact.RetrieveSharedPrincipals(userAuth, strContactId, rights);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class
  • Retrieve
  • RetrieveSharedPrincipalsAndAccess


CRMContact.RetrieveSharedPrincipalsAndAccess Method

The RetrieveSharedPrincipalsAndAccess method retrieves all the security principals (users or teams) that have access to a contact, along with what access they have.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipalsAndAccess(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByRef Rights As UInt32()
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipalsAndAccess(
  CUserAuth  Caller,
  string  ContactId,
  out uint[]  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipalsAndAccess(
  CUserAuth*  Caller,
  String*  ContactId,
  unsigned long*  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContact privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact.
Principals
[out] Specifies the array of security principals. See CSecurityPrincipal.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of rights. See ACCESSRIGHTS.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   uint[] rights;
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] principals ;

   // Retrieve the principals that share this contact
   principals = contact.RetrieveSharedPrincipalsAndAccess(userAuth, strContactId, out rights);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class
  • Retrieve
  • RetrieveSharedPrincipals


CRMContact.RetrieveSubLeads Method

The RetrieveSubLeads method retrieves the leads linked to the specified contact.

Syntax

[Visual Basic .NET]
Public Function RetrieveSubLeads(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveSubLeads(
  CUserAuth  Caller,
  string  ContactId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveSubLeads(
  CUserAuth*  Caller,
  String*  ContactId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLead privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in lead.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of leads requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<leads> + lead1..N + </leads>

where the XML schema for each lead is described by lead.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>leadid</column>";
   strColumnSetXml += "<column>firstname</column>";
   strColumnSetXml += "<column>lastname</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the child leads for this contact
   string strLeadsXml = contact.RetrieveSubLeads(userAuth, strContactId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class
  • Retrieve


CRMContact.RetrieveSubOpportunities Method

The RetrieveSubOpportunities method retrieves the opportunities linked to the specified contact.

Syntax

[Visual Basic .NET]
Public Function RetrieveSubOpportunities(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveSubOpportunities(
  CUserAuth  Caller,
  string  ContactId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveSubOpportunities(
  CUserAuth*  Caller,
  String*  ContactId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in opportunity.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of opportunities requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<opportunities> + opportunity1..N + </opportunities>

where the XML schema for each opportunity is described by opportunity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>opportunityid</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the child opportunities for this contact
   string strOpportunitiesXml = contact.RetrieveSubOpportunities(userAuth, strContactId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class
  • Retrieve


CRMContact.RevokeAccess Method

The RevokeAccess method revokes access rights to the contact for the specified security principal. This method also applies to all child objects of the contact. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the contact. In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

Syntax

[Visual Basic .NET]
Public Sub RevokeAccess(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal Revokee As CSecurityPrincipal
)
[C#]
public void RevokeAccess(
  CUserAuth  Caller,
  string  ContactId,
  CSecurityPrincipal  Revokee
);
[C++]
public: void RevokeAccess(
  CUserAuth*  Caller,
  String*  ContactId,
  CSecurityPrincipal*  Revokee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareContact privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact.
Revokee
Specifies the team or user whose access will be revoked. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId ;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Share the contact with the user
   contact.GrantAccess(userAuth, strContactId, rights, securityPrincipal);

   // Now revoke access
   contact.RevokeAccess(userAuth, strContactId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContact Class


CRMContact.Update Method

The Update method updates a contact.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal Contact As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  ContactId,
  string  Contact
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  ContactId,
  String*  Contact
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContact privilege to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact to update.
Contact
Specifies an XML string describing the contact. The XML schema is described by contact.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the contact
   string strContactXml = "<contact>";
   strContactXml += "<jobtitle>Master of Sales</jobtitle>";
   strContactXml += "<employeeid>7</employeeid>";
   strContactXml += "<emailaddress1>masterofsales@adventure-works.com</emailaddress1>";
   strContactXml += "</contact>";

   // Now update the contact with some new information
   contact.Update(userAuth, strContactId, strContactXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMContact Class
  • UpdateAndRetrieve


CRMContact.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates and then retrieves a contact.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ContactId As String,
  ByVal InContactXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  ContactId,
  string  InContactXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  ContactId,
  String*  InContactXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContact and prvReadContact privileges to perform this action. See CUserAuth.
ContactId
Specifies the ID of the contact to update.
InContactXml
Specifies an XML string describing the contact. The XML schema is described by contact.xsd.

Return Value

Returns a String type that specifies the XML data describing the newly updated contact. The XML schema is described by contact.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new Microsoft.Crm.Platform.Proxy.CRMContact ();
contact.Credentials = System.Net.CredentialCache.DefaultCredentials;
contact.Url = strDir + "CRMContact.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the contact
   strContactXml = "<contact>";
   strContactXml += "<jobtitle>Master of Sales</jobtitle>";
   strContactXml += "<employeeid>7</employeeid>";
   strContactXml += "<emailaddress1>masterofsales@adventure-works.com</emailaddress1>";
   strContactXml += "</contact>";

   // Now update the contact with some new information
   string strResultsXml = contact.UpdateAndRetrieve(userAuth, strContactId, strContactXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMContact Class
  • Update


CRMContract Class

The CRMContract class contains methods that you can use to manage contracts.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMContract
[Visual Basic .NET]
Public Class CRMContract
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMContract : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMContract: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMContract class exposes the following methods.

Method | Description
Assign | Assigns a contract to the specified security principal (user or team).
Cancel | Sets the state of a contract to Canceled.
Clone | Creates a copy of an existing contract and its line items.
Create | Creates a new contract.
CreateAndRetrieve | Creates a new contract and then retrieves it.
Delete | Deletes a contract.
GrantAccess | Grants access to a contract for the specified security principal.
Hold | Sets the state of a contract to Hold.
Invoice | Sets the state of a contract to Invoiced.
ModifyAccess | Replaces the access rights on the contract for the specified security principal.
ReleaseHold | Releases the hold from a contract.
Renew | Renews a contract and returns the new contract.
Retrieve | Retrieves a contract.
RetrieveByObject | Retrieves all of the contracts that are associated with a particular object (account).
RetrieveByObjectAndParent | Retrieves all of the contracts that are associated with a particular object (account or contact). In the case of a contact, this API also returns all contracts that are associated with the parent account of the contact.
RetrieveByPrincipal | Retrieves all of the contracts that are owned by a security principal.
RetrievePrincipalAccess | Retrieves the access rights that are assigned to a security principal for a specific contract.
RetrieveSharedPrincipalsAndAccess | Retrieves all security principals (users and teams) that have access to a contract and also the access rights that are assigned to these security principals
RevokeAccess | Revokes access to a contract for the specified security principal.
Update | Updates a contract.
UpdateAndRetrieve | Updates a contract and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Contract StateChanges
  • Microsoft.Crm.Platform.Proxy Classes


Contract State Changes

The following are the state changes for a contract object.

Method | New state | Flag
Create, Renew, and Clone | Draft | CTRST_DRAFT
Cancel | Canceled | CTRST_CANCEL
Hold | Hold | CTRST_HOLD
Invoice | Invoiced | CTRST_INVOICE


CRMContract.Assign Method

The Assign method assigns the contract to a security principal (user or team). (See Remarks.) This method also applies to the parent object and associated objects that have the same owner as the parent object. Therefore when you assign the parent object to a new owner, only the associated objects that have the same owner as the parent object are assigned. In addition, when an object is assigned to a new owner, it is shared with the previous owner with full rights. Either the new owner or the previous owner can remove the relationship or lower the level of privileges the previous owner had on the object.

Syntax

[Visual Basic .NET]
Public Sub Assign(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal Assignee As CSecurityPrincipal
)
[C#]
public void Assign(
  CUserAuth  Caller,
  string  ContractId,
  CSecurityPrincipal  Assignee
);
[C++]
public: void Assign(
  CUserAuth*  Caller,
  String*  ContractId,
  CSecurityPrincipal*  Assignee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignContract privilege to perform this action. See CUserAuth.
ContractId
Specifies the ID of the contract that is to be assigned.
Assignee
Specifies the team or user to which the account is to be assigned. See CSecurityPrincipal.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not support business-object assignments to teams. Therefore, solutions built by using this method are not supported by the Microsoft CRM application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the contract to another security principal
   contract.Assign(userAuth, strContractId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class


CRMContract.Cancel Method

The Cancel method sets the state of a contract to Canceled. The contract must be in either Active or Invoiced state in order to be canceled successfully.

Syntax

[Visual Basic .NET]
Public Sub Cancel(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal CancellationDate As String,
  ByVal Status As Integer
)
[C#]
public void Cancel(
  CUserAuth  Caller,
  string  ContractId,
  string  CancellationDate,
  int  Status
);
[C++]
public: void Cancel(
  CUserAuth*  Caller,
  String*  ContractId,
  String*  CancellationDate,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
ContractId
Specifies the ID of the contract that is to be canceled.
CancellationDate
Specifies the cancellation date.
Status
Specifies the state of the contract. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
string date = DateTime.Now.AddDays(5).ToString("s");
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Invoice the contract
   contract.Invoice(userAuth, strContractId, -1);

   // Hold the contract
   contract.Hold(userAuth, strContractId, -1);

   // Release the hold on the contract
   contract.ReleaseHold(userAuth, strContractId, -1);

   // Cancel the contract
   contract.Cancel(userAuth, strContractId, date, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class
  • State Changes in Contract


CRMContract.Clone Method

The Clone method creates a copy of an existing contract and its line items.

Syntax

[Visual Basic .NET]
Public Function Clone(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal IncludeCanceledLines As Integer
) As String
[C#]
public string Clone(
  CUserAuth  Caller,
  string  ContractId,
  int  IncludeCanceledLines
);
[C++]
public: String* Clone(
  CUserAuth*  Caller,
  String*  ContractId,
  long  IncludeCanceledLines
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateContract privilege to perform this action. See CUserAuth.
ContractId
Specifies the ID of the contract that is to be copied.
IncludeCanceledLines
Specifies a flag to indicate whether the canceled line items of the original contract are to be included in the copy (clone).

Return Value

Returns a String type that specifies the XML data containing the new contract information. The XML schema is described by contract.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Copy the contract
   string strNewContractXml = contract.Clone(userAuth, strContractId, 1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class
  • State Changes in Contract


CRMContract.Create Method

The Create method creates a contract.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal Contract As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  Contract
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  Contract
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateContract privilege to perform this action. See CUserAuth.
Contract
Specifies an XML string containing the new contract information. The XML schema is described by contract.xsd.

Return Value

Returns a String type that specifies the ID of the newly created contract.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractTemplateId = "{AC82B545-FD28-4F77-BF25-7D34985F3E6D}";
string strAccountId = "{FD42F065-174B-499C-90DA-0DE56405085A}";
string start = DateTime.Now.ToString("s");
string end = DateTime.Now.AddDays(5).ToString("s");
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the new contract
   string strContractXml = "<contract>";
   strContractXml += "<title>Contract Title</title>";
   strContractXml += "<contracttemplateid>" + strContractTemplateId + "</contracttemplateid>";
   strContractXml += "<customerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() +"\">";
   strContractXml += strAccountId + "</customerid>";
   strContractXml += "<billingcustomerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() +"\">";
   strContractXml += strAccountId + "</billingcustomerid>";
   strContractXml += "<billingstarton>" + start + "</billingstarton>";
   strContractXml += "<billingendon>" + end + "</billingendon>";
   strContractXml += "<activeon>" + start + "</activeon>";
   strContractXml += "<expireson>" + end + "</expireson>";
   strContractXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strContractXml += userAuth.UserId + "</ownerid>";
   strContractXml += "</contract>";

   string strContractId = contract.Create(userAuth, strContractXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMContract Class
  • State Changes in Contract
  • Update


CRMContract.CreateAndRetrieve Method

The CreateAndRetrieve method creates a contract and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InContractXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InContractXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InContractXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateContract and prvReadContract privileges to perform this action. See CUserAuth.
InContractXml
Specifies an XML string containing the new contract information. The XML schema is described by contract.xsd.

Return Value

Returns a String type that specifies the XML data containing the new contract information. The XML schema is described by contract.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractTemplateId = "{AC82B545-FD28-4F77-BF25-7D34985F3E6D}";
string strAccountId = "{FD42F065-174B-499C-90DA-0DE56405085A}";
string start = DateTime.Now.ToString("s");
string end = DateTime.Now.AddDays(5).ToString("s");
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the new contract
   string strContractXml = "<contract>";
   strContractXml += "<title>Contract Title</title>";
   strContractXml += "<contracttemplateid>" + strContractTemplateId + "</contracttemplateid>";
   strContractXml += "<customerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() +"\">";
   strContractXml += strAccountId + "</customerid>";
   strContractXml += "<billingcustomerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() +"\">";
   strContractXml += strAccountId + "</billingcustomerid>";
   strContractXml += "<billingstarton>" + start + "</billingstarton>";
   strContractXml += "<billingendon>" + end + "</billingendon>";
   strContractXml += "<activeon>" + start + "</activeon>";
   strContractXml += "<expireson>" + end + "</expireson>";
   strContractXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strContractXml += userAuth.UserId + "</ownerid>";
   strContractXml += "</contract>";

   string strContractXml = contract.CreateAndRetrieve(userAuth, strContractXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMContract Class
  • UpdateAndRetrieve


CRMContract.Delete Method

The Delete method deletes a contract.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ContractId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ContractId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteContract privilege to perform this action. See CUserAuth.
ContractId
Specifies the ID of the contract that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the contract
   contract.Delete(userAuth, strContractId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class


CRMContract.GrantAccess Method

The GrantAccess method grants a security principal access to the specified contract. This method also applies to all child objects of the contract. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the contract. In this case, only the lack of privileges for a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub GrantAccess(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)[C#]
public void GrantAccess(
  CUserAuth  Caller,
  string  ContractId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void GrantAccess(
  CUserAuth*  Caller,
  String*  ContractId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the owner of the contract and have the prvShareContract privilege to perform this action. See CUserAuth.
ContractId
Specifies the ID of the contract.
Rights
Specifies the set of rights that are to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or user that is to be granted access to the contract. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   contract.GrantAccess(userAuth, strContractId, rights, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class


CRMContract.Hold Method

The Hold method sets the state of a contract to Hold.

Syntax

[Visual Basic .NET]
Public Sub Hold(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal Status As Integer
)
[C#]
public void Hold(
  CUserAuth  Caller,
  string  ContractId,
  int  Status
);
[C++]
public: void Hold(
  CUserAuth*  Caller,
  String*  ContractId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
ContractId
Specifies the ID of the contract that is to be placed on hold.
Status
Specifies the state of the contract. You can use this for application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes that are used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
string date = DateTime.Now.AddDays(5).ToString("s");
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Invoice the contract
   contract.Invoice(userAuth, strContractId, -1);

   // Hold the contract
   contract.Hold(userAuth, strContractId, -1);

   // Release the hold on the contract
   contract.ReleaseHold(userAuth, strContractId, -1);

   // Cancel the contract
   contract.Cancel(userAuth, strContractId, date, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class
  • State Changes in Contract


CRMContract.Invoice Method

The Invoice method sets the state of a contract to Invoiced.

Syntax

[Visual Basic .NET]
Public Sub Invoice(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal Status As Integer
)
[C#]
public void Invoice(
  CUserAuth  Caller,
  string  ContractId,
  int  Status
);
[C++]
public: void Invoice(
  CUserAuth*  Caller,
  String*  ContractId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
ContractId
Specifies the ID of the contract that is to be invoiced.
Status
Specifies the state of the contract. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes that are used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
string date = DateTime.Now.AddDays(5).ToString("s");
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Invoice the contract
   contract.Invoice(userAuth, strContractId, -1);

   // Hold the contract
   contract.Hold(userAuth, strContractId, -1);

   // Release the hold on the contract
   contract.ReleaseHold(userAuth, strContractId, -1);

   // Cancel the contract
   contract.Cancel(userAuth, strContractId, date, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class
  • State Changes in Contract


CRMContract.ModifyAccess Method

The ModifyAccess method replaces the access rights on the contract for the specified security principal. This method also applies to all child objects of the contract. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the contract. In this case, only the lack of privileges to a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub ModifyAccess(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)[C#]
public void ModifyAccess(
  CUserAuth  Caller,
  string  ContractId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void ModifyAccess(
  CUserAuth*  Caller,
  String*  ContractId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvShareContract privilege to perform this action. See CUserAuth.
ContractId
Specifies the ID of the contract.
Rights
Specifies the set of rights that are to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or user to whom access is to be granted. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   contract.GrantAccess(userAuth, strContractId, rights, securityPrincipal);

   rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ | Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_SHARE;

   // Next call the method to modify access
   contract.ModifyAccess(userAuth, strContractId, rights, securityPrincipal);

   // Now revoke access
   contract.RevokeAccess(userAuth, strContractId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class


CRMContract.ReleaseHold Method

The ReleaseHold method removes the hold from a contract.

Syntax

[Visual Basic .NET]
Public Sub ReleaseHold(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal Status As Integer
)
[C#]
public void ReleaseHold(
  CUserAuth  Caller,
  string  ContractId,
  int  Status
);
[C++]
public: void ReleaseHold(
  CUserAuth*  Caller,
  String*  ContractId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
ContractId
Specifies the ID of the contract that is to be released from Hold.
Status
Specifies the state of the contract. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
string date = DateTime.Now.AddDays(5).ToString("s");
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Invoice the contract
   contract.Invoice(userAuth, strContractId, -1);

   // Hold the contract
   contract.Hold(userAuth, strContractId, -1);

   // Release the hold on the contract
   contract.ReleaseHold(userAuth, strContractId, -1);

   // Cancel the contract
   contract.Cancel(userAuth, strContractId, date, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class


CRMContract.Renew Method

The Renew method renews a contract and returns the XML data for the new contract. It also creates the new contract details for the new contract.

Syntax

[Visual Basic .NET]
Public Function Renew(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal Status As Integer,
  ByVal IncludeCanceledLines As Integer
) As String
[C#]
public string Renew(
  CUserAuth  Caller,
  string  ContractId,
  int  Status,
  int  IncludeCanceledLines
);
[C++]
public: String* Renew(
  CUserAuth*  Caller,
  String*  ContractId,
  long  Status,
  long  IncludeCanceledLines
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
ContractId
Specifies the ID of the contract that is to be renewed.
Status
Specifies the state of the contract. You can use this parameter to specify application status. See Remarks.
IncludeCanceledLines
Specifies a flag that indicates whether the canceled line items of the originating contract are to be included in the renewed contract.

Return Value

Returns a String type that specifies the XML data representing the renewed contract. The XML schema is described by contract.xsd.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Invoice the contract
   contract.Invoice(userAuth, strContractId, -1);

   // Renew the contract
   contract.Renew(userAuth, strContractId, -1, 0);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class
  • State Changes in Contract


CRMContract.Retrieve Method

The Retrieve method retrieves a contract.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  ContractId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  ContractId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContract privilege to perform this action. See CUserAuth.
ContractId
Specifies the ID of the contract that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contract.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the requested contact information. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by contract.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "<column>contractnumber</column>";
   strColumnSetXml += "<column>totalprice</column>";
   strColumnSetXml += "</columnset>";

   // Retreive the contract
   string strContractXml = contract.Retrieve(userAuth, strContractId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class
  • RetrieveByObject
  • RetrieveByObjectAndParent
  • RetrieveByPrincipal
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipalsAndAccess


CRMContract.RetrieveByObject Method

The RetrieveByObject method retrieves all contracts that are associated with the specified object (account).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContract privilege to perform this action. See CUserAuth.
Object
Specifies the object (account) for which contracts are to be retrieved. See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contract.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of retrieved contracts. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<contracts> + contract1..N + </contracts>

where the XML schema for each contract is described by contract.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strAccountId = "{FD42F065-174B-499C-90DA-0DE56405085A}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Retrieve all contracts that are associated with that account
   string strContractsXml = contract.RetrieveByObject(userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class
  • Retrieve
  • RetrieveByObjectAndParent
  • RetrieveByPrincipal
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipalsAndAccess


CRMContract.RetrieveByObjectAndParent Method

The RetrieveByObjectAndParent method retrieves all of the contracts associated with a particular object (account or contact). In the case of a contact, this API also returns all contracts that are associated with the parent account of the contact.

Syntax

[Visual Basic .NET]
Public Function RetrieveByObjectAndParent(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByObjectAndParent(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByObjectAndParent(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContract privilege to perform this action. See CUserAuth.
Object
Specifies the object for which contracts are to be retrieved (account or contact). See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contract.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of retrieved contracts. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<contracts> + contract1..N + </contracts>

where the XML schema for each contract is described by contract.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strAccountId = "{FD42F065-174B-499C-90DA-0DE56405085A}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Retrieve all contracts that are associated with that account
   // You will also retrieve the contracts that are associated with the parent of the account
   string strContractsXml = contract.RetrieveByObjectAndParent(userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class
  • Retrieve
  • RetrieveByObject
  • RetrieveByPrincipal
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipalsAndAccess


CRMContract.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves all of the contracts that are owned by a security principal (user or team).

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal Principal As CSecurityPrincipal,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  Principal,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  Principal,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContract privilege to perform this action. See CUserAuth.
Principal
Specifies the security principal whose contracts you want to retrieve. See CSecurityPrincipal.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contract.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of retrieved contracts. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<contracts> + contract1..N + </contracts>

where the XML schema for each contract is described by contract.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>contractid</column>";
   strColumnSetXml += "</columnset>";

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve all of the contracts for the specified security principal
   string strContractsXml = contract.RetrieveByPrincipal(userAuth, securityPrincipal, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class
  • Retrieve
  • RetrieveByObject
  • RetrieveByObjectAndParent
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipalsAndAccess


CRMContract.RetrievePrincipalAccess Method

The RetrievePrincipalAccess method retrieves the access that a specified security principal has to a contract.

Syntax

[Visual Basic .NET]
Public Function RetrievePrincipalAccess(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal Principal As CSecurityPrincipal
) As UInt32
[C#]
public uint RetrievePrincipalAccess(
  CUserAuth  Caller,
  string  ContractId,
  CSecurityPrincipal  Principal
);
[C++]
public: unsigned long RetrievePrincipalAccess(
  CUserAuth*  Caller,
  String*  ContractId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContract privilege to perform this action. See CUserAuth.
ContractId
Specifies the ID of the contract.
Principal
Specifies the security principal. See CSecurityPrincipal.

Return Value

Returns a UInt32 type that specifies the rights the security principal holds for the contract. See ACCESSRIGHTS.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   uint access = contract.RetrievePrincipalAccess(userAuth, strContractId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class
  • Retrieve
  • RetrieveByObject
  • RetrieveByObjectAndParent
  • RetrieveByPrincipal
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipalsAndAccess


CRMContract.RetrieveSharedPrincipalsAndAccess Method

The RetrieveSharedPrincipalsAndAccess method retrieves all of the security principals (users and teams) that have access to a contract and their access rights for that contract.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipalsAndAccess(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByRef Rights As UInt32()
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipalsAndAccess(
  CUserAuth  Caller,
  string  ContractId,
  out uint[]  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipalsAndAccess(
  CUserAuth*  Caller,
  String*  ContractId,
  unsigned long*  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContract privilege to perform this action. See CUserAuth.
ContractId
Specifies the ID of the contract.
Rights
Specifies the set of rights for the security principals. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of security principals associated with the specified contract. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;
   uint[] rights;

   securityPrincipals = contract.RetrieveSharedPrincipalsAndAccess(userAuth, strContractId, out rights);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class
  • Retrieve
  • RetrieveByObject
  • RetrieveByObjectAndParent
  • RetrieveByPrincipal
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipalsAndAccess


CRMContract.RevokeAccess Method

The RevokeAccess method revokes access rights to the contract for the specified security principal. This method also applies to all child objects of the contract. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the contract. In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

Syntax

[Visual Basic .NET]
Public Sub RevokeAccess(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal Revokee As CSecurityPrincipal
)
[C#]
public void RevokeAccess(
  CUserAuth  Caller,
  string  ContractId,
  CSecurityPrincipal  Revokee
);
[C++]
public: void RevokeAccess(
  CUserAuth*  Caller,
  String*  ContractId,
  CSecurityPrincipal*  Revokee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareContract privilege to perform this action. See CUserAuth.
ContractId
Specifies the ID of the contract.
Revokee
Specifies the team or user whose access is to be revoked. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   contract.GrantAccess(userAuth, strContractId, rights, securityPrincipal);

   rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ | Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_SHARE;

   // Next modify the access rights
   contract.ModifyAccess(userAuth, strContractId, rights, securityPrincipal);

   // Now revoke access
   contract.RevokeAccess(userAuth, strContractId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContract Class


CRMContract.Update Method

The Update method updates a contract.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal Contract As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  ContractId,
  string  Contract
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  ContractId,
  String*  Contract
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContract privilege to perform this action. See CUserAuth.
ContractId
Specifies the ID of the contract that is to be updated.
Contract
Specifies an XML string describing the contact. The XML schema is described by contract.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the contract
   string strContractXml = "<contract>";
   strContractXml += "<billingstarton>" + start + "</billingstarton>";
   strContractXml += "<billingendon>" + end + "</billingendon>";
   strContractXml += "</contract>";

   // Update the contract
   contract.Update(userAuth, strContractId, strContractXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMContract Class
  • UpdateAndRetrieve


CRMContract.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a contract and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal InContractXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  ContractId,
  string  InContractXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  ContractId,
  String*  InContractXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContract and prvReadContract privileges to perform this action. See CUserAuth.
ContractId
Specifies the ID of the contract.
InContractXml
Specifies an XML string describing the contract. The XML schema is described by contract.xsd.

Return Value

Returns a String type that specifies the XML data representing the newly updated contract. The XML schema is described by contract.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContract proxy object
Microsoft.Crm.Platform.Proxy.CRMContract contract = new Microsoft.Crm.Platform.Proxy.CRMContract ();
contract.Credentials = System.Net.CredentialCache.DefaultCredentials;
contract.Url = strDir + "CRMContract.srf";

string strErrorMsg;
string strContractId = "{A87D821C-DF25-4FA0-A4F6-E2F41AB2B336}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the contract
   string strContractXml = "<contract>";
   strContractXml += "<billingstarton>" + start + "</billingstarton>";
   strContractXml += "<billingendon>" + end + "</billingendon>";
   strContractXml += "</contract>";

   // Update and then retrieve the contract
   string strNewContractXml = contract.UpdateAndRetrieve(userAuth, strContractId, strContractXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMContract Class
  • Update


CRMContractDetail Class

The CRMContractDetail class contains methods that you can use to manage application contract details.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMContractDetail
[Visual Basic .NET]
Public Class CRMContractDetail
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMContractDetail : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMContractDetail: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMContractDetail class exposes the following methods.

Method | Description
Cancel | Sets the state a contract detail to Canceled.
Create | Creates a new contract detail.
CreateAndRetrieve | Creates a new contract detail and then retrieves it.
Delete | Deletes a contract detail.
Expire | Sets the state of a contract detail to Expired.
Retrieve | Retrieves a contract detail by ID.
RetrieveByContract | Retrieves the contract detail line items for the specified contract ID.
Update | Updates a contract detail.
UpdateAndRetrieve | Updates a contract detail and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMContractDetail.Cancel Method

The Cancel method sets the state of a contract detail to Canceled. If the contract line has expired, you cannot cancel it. Also, you can cancel the contract line item only if its parent contract is in either the Active or Invoiced state.

Syntax

[Visual Basic .NET]
Public Sub Cancel(
  ByVal Caller As CUserAuth,
  ByVal ContractDetailId As String,
  ByVal Status As Integer
)
[C#]
public void Cancel(
  CUserAuth  Caller,
  string  ContractDetailId,
  int  Status
);
[C++]
public: void Cancel(
  CUserAuth*  Caller,
  String*  ContractDetailId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContract privilege to perform this action. See CUserAuth.
ContractDetailId
Specifies the ID of the contract detail that is to be canceled.
Status
Specifies the new status code for the contract detail. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMContractDetail  contractdetail = new Microsoft.Crm.Platform.Proxy.CRMContractDetail();
contractdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractdetail.Url = strDir + "CRMContractDetail.srf";

string strErrorMsg;
string strContractDetailId= "{506D234F-CF08-40CD-8059-CC0DF6377A19}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Cancel the contract detail
   contractdetail.Cancel (userAuth, strContractDetailId, -1);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContractDetail Class


CRMContractDetail.Create Method

The Create method creates a contract detail.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal ContractDetail As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  ContractDetail
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  ContractDetail
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateContract privilege to perform this action. See CUserAuth.
ContractDetail
Specifies the XML string containing the contract detail information. The XML schema is described by contractdetail.xsd.

Return Value

Returns a String type that specifies the ID of the newly created contract detail.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMContractDetail  contractdetail = new Microsoft.Crm.Platform.Proxy.CRMContractDetail();
contractdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractdetail.Url = strDir + "CRMContractDetail.srf";

string strErrorMsg;
string strContractId ="{AE6C8B20-3SDF-4C83-9986-57719B8DA83D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the contract detail
   string xml = "<contractdetail>";
   xml += "<contractid>" + strContractId + "</contractid>";
   xml += "<title>contract detail title</title>";
   xml += "</contractdetail>";

   // Create the contract detail
   string strContractDetailId = contractdetail.Create (userAuth, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMContractDetail Class
  • Update


CRMContractDetail.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new contract detail and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InContractXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InContractXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InContractXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateContract and prvReadContract privileges to perform this action. See CUserAuth.
InContractXml
Specifies the XML string containing the contract detail information. The XML schema is described by contractdetail.xsd.

Return Value

Returns a String type that specifies the XML data containing the newly created contract detail information. The XML schema is described by contractdetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMContractDetail  contractdetail = new Microsoft.Crm.Platform.Proxy.CRMContractDetail();
contractdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractdetail.Url = strDir + "CRMContractDetail.srf";

string strErrorMsg;
string strContractId = "";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the contract detail
   string xml = "<contractdetail>";
   xml += "<contractid>" + strContractId + "</contractid>";
   xml += "<title>Contract detail title</title>";
   xml += "</contractdetail>";

   // Create the contract detail, and then retrieve it
   string strContractXML = contractdetail.CreateAndRetrieve(userAuth, xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMContractDetail Class
  • UpdateAndRetrieve


CRMContractDetail.Delete Method

The Delete method deletes a contract detail.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ContractDetailId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ContractDetailId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ContractDetailId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteContract privilege to perform this action. See CUserAuth.
ContractDetailId
Specifies the ID of the contract detail that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMContractDetail  contractdetail = new Microsoft.Crm.Platform.Proxy.CRMContractDetail();
contractdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractdetail.Url = strDir + "CRMContractDetail.srf";

string strErrorMsg;
string strContractDetailId = "{506D234F-CF08-40CD-8059-CC0DF6377A19}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the contract detail
   contractdetail.Delete (userAuth, strContractDetailId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContractDetail Class


CRMContractDetail.Expire Method

The Expire method sets the state of a contract detail to Expired. This method fails if the state of the contract line item is Canceled.

Syntax

[Visual Basic .NET]
Public Sub Expire(
  ByVal Caller As CUserAuth,
  ByVal ContractDetailId As String,
  ByVal Status As Integer
)
[C#]
public void Expire(
  CUserAuth  Caller,
  string  ContractDetailId,
  int  Status
);
[C++]
public: void Expire(
  CUserAuth*  Caller,
  String*  ContractDetailId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContract privilege to perform this action. See CUserAuth.
ContractDetailId
Specifies the ID of the contract detail that is to be canceled.
Status
Specifies the new status code for the contract detail. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMContractDetail  contractdetail = new Microsoft.Crm.Platform.Proxy.CRMContractDetail();
contractdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractdetail.Url = strDir + "CRMContractDetail.srf";

string strErrorMsg;
string strContractDetailId = "{506D234F-CF08-40CD-8059-CC0DF6377A19}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set the state of the contract detail to Expired
   contractdetail.Expire(userAuth, strContractDetailId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContractDetail Class


CRMContractDetail.Retrieve Method

The Retrieve method retrieves a contract detail by using the specified ID.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal ContractDetailId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  ContractDetailId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  ContractDetailId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContract privilege to perform this action. See CUserAuth.
ContractDetailId
Specifies the ID of the contract detail that is to be retrieved.
ColumnSetXML
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contractdetail.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the contract detail information. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by contractdetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMContractDetail  contractdetail = new Microsoft.Crm.Platform.Proxy.CRMContractDetail();
contractdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractdetail.Url = strDir + "CRMContractDetail.srf";

string strErrorMsg;
string strContractDetailId= "{506D234F-CF08-40CD-8059-CC0DF6377A19}";
string strColumnSetXml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>contractdetailid</column>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the contract detail
   string strResultsXml = contractdetail.Retrieve (userAuth, strContractDetailId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContractDetail Class


CRMContractDetail.RetrieveByContract Method

The RetrieveByContract method retrieves the contract detail line items for the specified contract ID.

Syntax

[Visual Basic .NET]
Public Function RetrieveByContract(
  ByVal Caller As CUserAuth,
  ByVal ContractId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByContract(
  CUserAuth  Caller,
  string  ContractId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByContract(
  CUserAuth*  Caller,
  String*  ContractId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContract privilege to perform this action. See CUserAuth.
ContractlId
Specifies the ID of the contract for which the contract detail is to be retrieved.
ColumnSetXML
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contractdetail.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the contract detail information. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<contractdetails> + contractdetail1..N + </contractdetails>

where the XML schema for each contract is described by contractdetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMContractDetail  contractdetail = new Microsoft.Crm.Platform.Proxy.CRMContractDetail();
contractdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractdetail.Url = strDir + "CRMContractDetail.srf";

string strErrorMsg;
string strColumnSetXml;
string strContractId = "{AE6C8B20-3SDF-4C83-9986-57719B8DA83D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>contractdetailid</column>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the contract detail
   string strResultsXml = contractdetail.RetrieveByContract(userAuth, strContractId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContractDetail Class
  • Retrieve


CRMContractDetail.Update Method

The Update method updates a contract detail.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal ContractDetailId As String,
  ByVal ContractDetail As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  ContractDetailId,
  string  ContractDetail
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  ContractDetailId,
  String*  ContractDetail
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContract privilege to perform this action. See CUserAuth.
ContractDetailId
Specifies the ID of the contract detail that is to be updated.
ContractDetail
Specifies the XML string containing the contract detail information. The XML schema is described by contractdetail.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMContractDetail  contractdetail = new Microsoft.Crm.Platform.Proxy.CRMContractDetail();
contractdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractdetail.Url = strDir + "CRMContractDetail.srf";

string strErrorMsg;
string strContractDetailId="{506D234F-CF08-40CD-8059-CC0DF6377A19}";
string xml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the contract detail
   xml = "<contractdetail>";
   xml += "<title>contract detail changed </title>";
   xml += "</contractdetail>";

   // Update the contract detail
   contractdetail.Update(userAuth, strContractDetailId, xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMContractDetail Class
  • UpdateAndRetrieve


CRMContractDetail.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a contract detail and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ContractDetailId As String,
  ByVal InContractDetailXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  ContractDetailId,
  string  InContractDetailXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  ContractDetailId,
  String*  InContractDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContract and prvReadContract privileges to perform this action. See CUserAuth.
ContractDetailId
Specifies the ID of the contract detail that is to be updated.
InContractDetailXml
Specifies the XML string containing the contract detail information. The XML schema is described by contractdetail.xsd.

Return Value

Returns a String type that specifies the XML data containing the contract detail information. The XML schema is described by contractdetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMContractDetail  contractdetail = new Microsoft.Crm.Platform.Proxy.CRMContractDetail();
contractdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractdetail.Url = strDir + "CRMContractDetail.srf";

string strErrorMsg;
string strContractDetailId = "{506D234F-CF08-40CD-8059-CC0DF6377A19}";
string xml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the contract detail
   xml = "<contractdetail>";
   xml += "<title>contract detail changed</title>";
   xml += "</contractdetail>";

   // Update the contract detail, and then retrieve it
   string strResultsXml = contractdetail.UpdateAndRetrieve (userAuth, strContractDetailId, xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMContractDetail Class
  • Update


CRMContractTemplate Class

The CRMContractTemplate class contains methods that you can use to manage application contract templates.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMContractTemplate
[Visual Basic .NET]
Public Class CRMContractTemplate
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMContractTemplate : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMContractTemplate: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMContractTemplate class exposes the following methods.

Method | Description
Create | Creates a new contract template.
CreateAndRetrieve | Creates a new contract template and then retrieves it.
Delete | Deletes a contract template.
Retrieve | Retrieves a contract template by ID.
RetrieveByOrganization | Retrieves all of the contract templates for the specified organization.
Update | Updates a contract template.
UpdateAndRetrieve | Updates a contract template and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMContractTemplate.Create Method

The Create method creates a contract template.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal ContractTemplate As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  ContractTemplate
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  ContractTemplate
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateContractTemplate privilege to perform this action. See CUserAuth.
ContractTemplate
Specifies the XML string containing the contract template information. The XML schema is described by contracttemplate.xsd.

Return Value

Returns a String type that specifies the ID of the newly created contract template.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMContractTemplate contractTemplate = new Microsoft.Crm.Platform.Proxy.CRMContractTemplate ();
contractTemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractTemplate.Url = strDir + "CRMContractTemplate.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the new contract template
   string strContractTemplateXml = "<contracttemplate>";
   strContractTemplateXml += "<name>Contract Template 5</name>";
   strContractTemplateXml += "<abbreviation>CT5</abbreviation>";
   strContractTemplateXml += "</contracttemplate>";

   // Create a contract template
   string strContractTemplateId = contractTemplate.Create(userAuth, strContractTemplateXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMContractTemplate Class
  • Update


CRMContractTemplate.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new contract template and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InContractXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InContractXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InContractXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateContractTemplate and prvReadContractTemplate privileges to perform this action. See CUserAuth.
InContractXml
Specifies the XML string containing the contract template information. The XML schema is described by contracttemplate.xsd.

Return Value

Returns a String type that specifies the XML data containing the newly created contract template information. The XML schema is described by contracttemplate.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMContractTemplate contractTemplate = new Microsoft.Crm.Platform.Proxy.CRMContractTemplate ();
contractTemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractTemplate.Url = strDir + "CRMContractTemplate.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the new contract template
   string strContractTemplateXml = "<contracttemplate>";
   strContractTemplateXml += "<name>Contract Template 3</name>";
   strContractTemplateXml += "<abbreviation>CT2</abbreviation>";
   strContractTemplateXml += "</contracttemplate>";

   // Create the contract template, and then retrieve it
   string strNewContractTemplateXml = contractTemplate.CreateAndRetrieve(userAuth, strContractTemplateXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMContractTemplate Class
  • UpdateAndRetrieve


CRMContractTemplate.Delete Method

The Delete method deletes a contract template.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ContractTemplateId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ContractTemplateId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ContractTemplateId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteContractTemplate privilege to perform this action. See CUserAuth.
ContractTemplateId
Specifies the ID of the contract template that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMContractTemplate contractTemplate = new Microsoft.Crm.Platform.Proxy.CRMContractTemplate ();
contractTemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractTemplate.Url = strDir + "CRMContractTemplate.srf";

string strErrorMsg;
string strContractTemplateId = "{AC82B545-FD28-4F77-BF25-7D34985F3E6D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the contract template
   contractTemplate.Delete (userAuth, strContractTemplateId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContractTemplate Class


CRMContractTemplate.Retrieve Method

The Retrieve method retrieves a contract template by ID.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal ContractTemplateId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  ContractTemplateId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  ContractTemplateId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContractTemplate privilege to perform this action. See CUserAuth.
ContractTemplateId
Specifies the ID of the contract template that is to be retrieved.
ColumnSetXML
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contracttemplate.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the contract template information. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by contracttemplate.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMContractTemplate contractTemplate = new Microsoft.Crm.Platform.Proxy.CRMContractTemplate ();
contractTemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractTemplate.Url = strDir + "CRMContractTemplate.srf";

string strErrorMsg;
string strContractTemplateId = "{AC82B545-FD28-4F77-BF25-7D34985F3E6D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>abbreviation</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the contract template
   string strResultXml = contractTemplate.Retrieve (userAuth, strContractTemplateId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContractTemplate Class
  • RetrieveByOrganization


CRMContractTemplate.RetrieveByOrganization Method

The RetrieveByOrganization method retrieves all of the contract templates for the specified organization.

Syntax

[Visual Basic .NET]
Public Function RetrieveByOrganization(
  ByVal Caller As CUserAuth,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveByOrganization(
  CUserAuth  Caller,
  string  ColumnSet
);
[C++]
public: String* RetrieveByOrganization(
  CUserAuth*  Caller,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContractTemplate privilege to perform this action. See CUserAuth.
ColumnSetXML
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contracttemplate.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the contract template information. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<contracttemplates> + contracttemplate1..N + </contracttemplates>

where the XML schema for each contract template is described by contracttemplate.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMContractTemplate contractTemplate = new Microsoft.Crm.Platform.Proxy.CRMContractTemplate ();
contractTemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractTemplate.Url = strDir + "CRMContractTemplate.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>abbreviation</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the contract templates
   string strResultXml = contractTemplate.RetrieveByOrganization (userAuth, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMContractTemplate Class
  • Retrieve


CRMContractTemplate.Update Method

The Update method updates a contract template.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal ContractTemplateId As String,
  ByVal ContractTemplate As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  ContractTemplateId,
  string  ContractTemplate
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  ContractTemplateId,
  String*  ContractTemplate
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteContractTemplate privilege to perform this action. See CUserAuth.
ContractTemplateId
Specifies the ID of the contract template that is to be updated.
ContractTemplate
Specifies the XML string containing the contract template information. The XML schema is described by contracttemplate.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMContractTemplate contractTemplate = new Microsoft.Crm.Platform.Proxy.CRMContractTemplate ();
contractTemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractTemplate.Url = strDir + "CRMContractTemplate.srf";

string strErrorMsg;
string strContractTemplateXml;
string strContractTemplateId="{AC82B545-FD28-4F77-BF25-7D34985F3E6D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the contract template
   strContractTemplateXml = "<contracttemplate>";
   strContractTemplateXml += "<name>Contract Template 1</name>";
   strContractTemplateXml += "<abbreviation>CT5 changed</abbreviation>";
   strContractTemplateXml += "</contracttemplate>";

   // Update the template
   contractTemplate.Update (userAuth, strContractTemplateId, strContractTemplateXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMContractTemplate Class
  • UpdateAndRetrieve


CRMContractTemplate.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a contract template and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ContractTemplateId As String,
  ByVal InContractTemplateXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  ContractTemplateId,
  string  InContractTemplateXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  ContractTemplateId,
  String*  InContractTemplateXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadContractTemplate and prvWriteContractTemplate privileges to perform this action. See CUserAuth.
ContractTemplateId
Specifies the ID of the contract template that is to be updated.
InContractTemplateXml
Specifies the XML string containing the contract template information. The XML schema is described by contracttemplate.xsd.

Return Value

Returns a String type that specifies the XML data containing the contract template information. The XML schema is described by contracttemplate.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMContractTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMContractTemplate contractTemplate = new Microsoft.Crm.Platform.Proxy.CRMContractTemplate ();
contractTemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
contractTemplate.Url = strDir + "CRMContractTemplate.srf";

string strErrorMsg;
string strContractTemplateId = "{AC82B545-FD28-4F77-BF25-7D34985F3E6D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the new contract template
   string strContractTemplateXml = "<contracttemplate>";
   strContractTemplateXml += "<name>Contract Template 1</name>";
   strContractTemplateXml += "<abbreviation>CT5 changed</abbreviation>";
   strContractTemplateXml += "</contracttemplate>";

   // Update the template, and then retrieve it
   string resultXml = contractTemplate.UpdateAndRetrieve (userAuth, strContractTemplateId, strContractTemplateXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMContractTemplate Class
  • Update


CRMCustomerAddress Class

The CRMCustomerAddress class contains methods that you can use to manage customer addresses for an organization.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMCustomerAddress
[Visual Basic .NET]
Public Class CRMCustomerAddress
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMCustomerAddress : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMCustomerAddress: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMCustomerAddress class exposes the following methods.

Method | Description
Create | Creates a customer address.
CreateAndRetrieve | Creates a customer address and then retrieves it.
Delete | Deletes a customer address.
Retrieve | Retrieves a customer address.
RetrieveByObject | Retrieves all addresses that are associated with an object (account or contact).
Update | Updates a customer address.
UpdateAndRetrieve | Updates a customer address and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMCustomerAddress.Create Method

The Create method creates a customer address.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal EntityXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  EntityXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  EntityXML
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
EntityXML
Specifies the XML string containing the customer address information. The XML schema is described by customeraddress.xsd.

Return Value

Returns a String type that specifies the ID of the newly created customer address.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCustomerAddress proxy object
Microsoft.Crm.Platform.Proxy.CRMCustomerAddress  customeraddress = new Microsoft.Crm.Platform.Proxy.CRMCustomerAddress ();
customeraddress.Credentials = System.Net.CredentialCache.DefaultCredentials;
customeraddress.Url = strDir + "CRMCustomerAddress.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for a new customer address
   string strCustomerAddressXML = "<customeraddress><name>Customer name 1</name> ";
   strCustomerAddressXML += "<parentid>" + strAccountId + "</parentid>";
   strCustomerAddressXML += "<addressnumber>0</addressnumber>";
   strCustomerAddressXML += "<objecttypecode>" + Microsoft.Crm.Platform.Types.CUSTOMER_ADDRESS_TYPE.CAT_ACCOUNT + "</objecttypecode>";
   strCustomerAddressXML += "</customeraddress>";

   // Now create customer address
   string strCustomerAddressId = customeraddress.Create(userAuth, strCustomerAddressXML);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMCustomerAddress Class
  • Update


CRMCustomerAddress.CreateAndRetrieve Method

The CreateAndRetrieve method creates a customer address and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityXml As String,
  ByVal ColumnSet As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  EntityXml,
  string  ColumnSet
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  EntityXml,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
EntityXml
Specifies the XML string containing the customer address information. The XML schema is described by customeraddress.xsd.
ColumnSet
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in customeraddress.xsd.

Return Value

Returns a String type that specifies the XML data containing the newly created customer address information. The XML schema is described by customeraddress.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCustomerAddress proxy object
Microsoft.Crm.Platform.Proxy.CRMCustomerAddress  customeraddress = new Microsoft.Crm.Platform.Proxy.CRMCustomerAddress ();
customeraddress.Credentials = System.Net.CredentialCache.DefaultCredentials;
customeraddress.Url = strDir + "CRMCustomerAddress.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>customeraddressid</column>";
   strColumnSetXml += "</columnset>";

   // Set up the XML string for a new customer address
   string strCustomerAddressXML = "<customeraddress><name>Customer name 1</name> ";
   strCustomerAddressXML += "<parentid>" + strAccountId + "</parentid>";
   strCustomerAddressXML += "<addressnumber>0</addressnumber>";
   strCustomerAddressXML += "<objecttypecode>" + Microsoft.Crm.Platform.Types.CUSTOMER_ADDRESS_TYPE.CAT_ACCOUNT + "</objecttypecode>";
   strCustomerAddressXML += "</customeraddress>";

   // Create and then retrieve the customer address
   string strCustomerAddressXml = customeraddress.CreateAndRetrieve (userAuth,strCustomerAddressXML,strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMCustomerAddress Class
  • UpdateAndRetrieve


CRMCustomerAddress.Delete Method

The Delete method deletes a customer address.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  EntityId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  EntityId
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
EntityId
Specifies the ID of the customer address that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCustomerAddress proxy object
Microsoft.Crm.Platform.Proxy.CRMCustomerAddress  customeraddress = new Microsoft.Crm.Platform.Proxy.CRMCustomerAddress ();
customeraddress.Credentials = System.Net.CredentialCache.DefaultCredentials;
customeraddress.Url = strDir + "CRMCustomerAddress.srf";

string strErrorMsg;
string strCustomerAddressId = "{398912CF-1576-4EB8-A6CE-3AE25BD101D4}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete customer address
   customeraddress.Delete(userAuth, strCustomerAddressId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMCustomerAddress Class


CRMCustomerAddress.Retrieve Method

The Retrieve method retrieves a customer address.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  EntityId,
  string  ColumnSet
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
EntityId
Specifies the ID of the customer address that is to be retrieved.
ColumnSet
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in customeraddress.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested customer address information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by customeraddress.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCustomerAddress proxy object
Microsoft.Crm.Platform.Proxy.CRMCustomerAddress  customeraddress = new Microsoft.Crm.Platform.Proxy.CRMCustomerAddress ();
customeraddress.Credentials = System.Net.CredentialCache.DefaultCredentials;
customeraddress.Url = strDir + "CRMCustomerAddress.srf";

string strErrorMsg;
string strCustomerAddressId = "{398912CF-1576-4EB8-A6CE-3AE25BD101D4}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>customeraddressid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Now retrieve the customer address
   string strResultsXml = customeraddress.Retrieve(userAuth, strCustomerAddressId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMCustomerAddress Class
  • RetrieveByObject


CRMCustomerAddress.RetrieveByObject Method

The RetrieveByObject method retrieves all addresses that are associated with an object (account or contact).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal RetrievePrimarySites As Integer,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  int  RetrievePrimarySites,
  string  ColumnSet
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  long  RetrievePrimarySites,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
Object
Specifies the object (account or contact) for which customer addresses are to be retrieved. See CObjectName.
RetrievePrimaryCustomerAddresses
If true, addresses 1 and 2 are both retrieved.
ColumnSet
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in customeraddress.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of customer addresses associated with the specified account or contact. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<customeraddresses> + customeraddress1..N + </customeraddresses>

where the XML schema for each customer address is described by customeraddress.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCustomerAddress proxy object
Microsoft.Crm.Platform.Proxy.CRMCustomerAddress  customeraddress = new Microsoft.Crm.Platform.Proxy.CRMCustomerAddress ();
customeraddress.Credentials = System.Net.CredentialCache.DefaultCredentials;
customeraddress.Url = strDir + "CRMCustomerAddress.srf";
string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>customeraddressid</column>";
   strColumnSetXml += "</columnset>";

   // Instantiate an account object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Retrieve all of the customer addresses for the specified object
   string strResultsXml = customeraddress.RetrieveByObject(userAuth, objName, 1, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMCustomerAddress Class
  • Retrieve


CRMCustomerAddress.Update Method

The Update method updates a customer address.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal EntityXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  EntityId,
  string  EntityXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  EntityXml
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
EntityId
Specifies the ID of the customer address that is to be updated.
EntityXml
Specifies the XML string containing the new customer address information. The XML schema is described by customeraddress.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCustomerAddress proxy object
Microsoft.Crm.Platform.Proxy.CRMCustomerAddress  customeraddress = new Microsoft.Crm.Platform.Proxy.CRMCustomerAddress ();
customeraddress.Credentials = System.Net.CredentialCache.DefaultCredentials;
customeraddress.Url = strDir + "CRMCustomerAddress.srf";
string strErrorMsg;
string strCustomerAddressId = "{398912CF-1576-4EB8-A6CE-3AE25BD101D4}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Update the XML string for the customer address
   string strCustomerAddressXML = "<customeraddress>";
   strCustomerAddressXML += "<city>Lewiston</city>";
   strCustomerAddressXML += "</customeraddress>";

   // Now update the customer address
   customeraddress.Update(userAuth, strCustomerAddressId, strCustomerAddressXML);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMCustomerAddress Class
  • UpdateAndRetrieve


CRMCustomerAddress.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a customer address and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal EntityXml As String,
  ByVal ColumnSet As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  EntityId,
  string  EntityXml,
  string  ColumnSet
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  EntityXml,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. See CUserAuth.
EntityId
Specifies the ID of the customer address that is to be updated.
EntityXml
Specifies the XML string containing the new customer address information. The XML schema is described by customeraddress.xsd.
ColumnSet
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in customeraddress.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the customer address information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by customeraddress.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCustomerAddress proxy object
Microsoft.Crm.Platform.Proxy.CRMCustomerAddress  customeraddress = new Microsoft.Crm.Platform.Proxy.CRMCustomerAddress ();
customeraddress.Credentials = System.Net.CredentialCache.DefaultCredentials;
customeraddress.Url = strDir + "CRMCustomerAddress.srf";

string strErrorMsg;
string strCustomerAddressId = "{398912CF-1576-4EB8-A6CE-3AE25BD101D4}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Update the XML string for the customer address
   string strCustomerAddressXML = "<customeraddress>";
   strCustomerAddressXML += "<city>Seattle</city>";
   strCustomerAddressXML += "</customeraddress>";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>customeraddressid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Now update the customer address
   string strResultsXml = customeraddress.UpdateAndRetrieve(userAuth, strCustomerAddressId, strCustomerAddressXML, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMCustomerAddress Class
  • Update


CRMCustomization Class

The CRMCustomization class contains methods that you can use to manage application customization.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMCustomization
[Visual Basic .NET]
Public Class CRMCustomization
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMCustomization : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMCustomization: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMCustomization class exposes the following methods.

Method | Description
CreateOrganizationUI | For internal use only. Note: Access to the Organization UI object is through the tools that are provided with the Microsoft CRM application.
RetrieveEntityXml | For internal use only.
RetrieveLatestOrganizationUIByOrgId | For internal use only. Note: Access to the Organization UI object is through the tools that are provided with the Microsoft CRM application.
RetrieveOrganizationUI | For internal use only. Note: Access to the Organization UI object is through the tools that are provided with the Microsoft CRM application.
RetrieveOrganizationUIByOrgId | For internal use only. Note: Access to the Organization UI object is through the tools that are provided with the Microsoft CRM application.
RetrievePicklist | Retrieves the drop-down list (picklist) values and their associated names for the specified object type.
RetrieveState | Retrieves the state codes and the state code names for the specified object type.
RetrieveStatus | Retrieves the status codes for the object (and also the status code names if the status is the default status for the specified state).
Transform | Generates the target object XML data from the source object.
UpdateOrganizationUI | For internal use only. Note: Access to the Organization UI object is through the tools that are provided with the Microsoft CRM application.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMCustomization.RetrievePicklist Method

The RetrievePicklist method retrieves the drop-down list (picklist) values and their associated names for the specified object type.

Syntax

[Visual Basic .NET]
Public Function RetrievePicklist(
  ByVal Caller As CUserAuth,
  ByVal ObjectTypeCode As Integer,
  ByVal AttributeName As String
) As String
[C#]
public string RetrievePicklist(
  CUserAuth  Caller,
  int  ObjectTypeCode,
  string  AttributeName
);
[C++]
public: String* RetrievePicklist(
  CUserAuth*  Caller,
  long  ObjectTypeCode,
  String*  AttributeName
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadCustomization privilege to perform this action. See CUserAuth.
ObjectTypeCode
Specifies the type of the object. See ObjectType.
AttributeName
Specifies the name of the drop-down list (picklist).

Return Value

Returns a String type that specifies the XML data containing the drop down list (picklist) values and their associated names.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCustomization proxy object
Microsoft.Crm.Platform.Proxy.CRMCustomization customization = new Microsoft.Crm.Platform.Proxy.CRMCustomization();
customization.Credentials = System.Net.CredentialCache.DefaultCredentials;
customization.Url = strDir + "CRMCustomization.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the drop-down list values
   string strResultsXml = customization.RetrievePicklist(userAuth, Microsoft.Crm.Platform.Types.ObjectType.otAccount, "paymenttermscode");

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMCustomization Class


CRMCustomization.RetrieveState Method

The RetrieveState method retrieves state codes and the state code names for the specified object type.

Syntax

[Visual Basic .NET]
Public Function RetrieveState(
  ByVal Caller As CUserAuth,
  ByVal ObjectTypeCode As Integer
) As String
[C#]
public string RetrieveState(
  CUserAuth  Caller,
  int  ObjectTypeCode
);
[C++]
public: String* RetrieveState(
  CUserAuth*  Caller,
  long  ObjectTypeCode
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadCustomization privilege to perform this action. See CUserAuth.
ObjectTypeCode
Specifies the type of the object. See ObjectType.

Return Value

Returns a String type that specifies the XML data containing the state codes and the state code names.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCustomization proxy object
Microsoft.Crm.Platform.Proxy.CRMCustomization customization = new Microsoft.Crm.Platform.Proxy.CRMCustomization();
customization.Credentials = System.Net.CredentialCache.DefaultCredentials;
customization.Url = strDir + "CRMCustomization.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve state values
   string strResultsXml = customization.RetrieveState (userAuth, Microsoft.Crm.Platform.Types.ObjectType.otAccount);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMCustomization Class


CRMCustomization.RetrieveStatus Method

The RetrieveStatus method retrieves the status codes for the specified object (and also the status code names if the status is the default status for the given state).

Syntax

[Visual Basic .NET]
Public Function RetrieveStatus(
  ByVal Caller As CUserAuth,
  ByVal ObjectTypeCode As Integer,
  ByVal State As Integer
) As String
[C#]
public string RetrieveStatus(
  CUserAuth  Caller,
  int  ObjectTypeCode,
  int  State
);
[C++]
public: String* RetrieveStatus(
  CUserAuth*  Caller,
  long  ObjectTypeCode,
  long  State
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadCustomization privilege to perform this action. See CUserAuth.
ObjectTypeCode
Specifies the type of the object. See ObjectType.
State
Specifies the state of the object.

Return Value

Returns a String type that specifies the XML data containing the status codes, the status code names, and information about whether the status is the default status.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCustomization proxy object
Microsoft.Crm.Platform.Proxy.CRMCustomization    customization = new Microsoft.Crm.Platform.Proxy.CRMCustomization();
customization.Credentials = System.Net.CredentialCache.DefaultCredentials;
customization.Url = strDir + "CRMCustomization.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the status values
   string strResultsXml = customization.RetrieveStatus (userAuth, Microsoft.Crm.Platform.Types.ObjectType.otAccount, 1);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMCustomization Class


CRMCustomization.Transform Method

The Transform method generates the target object XML data from the source object.

Syntax

[Visual Basic .NET]
Public Function Transform(
  ByVal Caller As CUserAuth,
  ByVal SourceObject As CObjectName,
  ByVal TargetObjectType As Integer,
  ByVal TargetFieldType As Integer
) As String
[C#]
public string Transform(
  CUserAuth  Caller,
  CObjectName  SourceObject,
  int  TargetObjectType,
  int  TargetFieldType
);
[C++]
public: String* Transform(
  CUserAuth*  Caller,
  CObjectName*  SourceObject,
  long  TargetObjectType,
  long  TargetFieldType
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadCustomization privilege to perform this action. See CUserAuth.
SourceObject
Specifies the source object from which target object is to be generated. See CObjectName.
TargetObjectType
Specifies the type of the target object. See ObjectType.
TargetFieldType
Specifies the type of fields in the target object XML string: all fields, only the fields valid for create, or only the fields valid for update. See TRANSFORM_TARGET_FIELD_TYPE Class

Return Value

Returns a String type that specifies the XML data that is generated for the target object.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMCustomization proxy object
Microsoft.Crm.Platform.Proxy.CRMCustomization    customization = new Microsoft.Crm.Platform.Proxy.CRMCustomization();
customization.Credentials = System.Net.CredentialCache.DefaultCredentials;
customization.Url = strDir + "CRMCustomization.srf";

string strErrorMsg;
string strOpportunityId = "{64A1C978-4A67-4845-B481-F4A81F67B5E0}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Initialize the opportunity object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strOpportunityId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otOpportunity;

   // Convert an opportunity to a quote
   string strResultsXml = customization.Transform (userAuth, objName, Microsoft.Crm.Platform.Types.ObjectType.otQuote, 4);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMCustomization Class


CRMDiscount Class

The CRMDiscount class contains methods that you can use to manage discounts.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMDiscount
[Visual Basic .NET]
Public Class CRMDiscount
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMDiscount : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMDiscount: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMDiscount class exposes the following methods.

Method | Description
Create | Creates a new discount.
CreateAndRetrieve | Creates a discount and then retrieves it.
Delete | Deletes a discount.
Retrieve | Retrieves a discount.
RetrieveByObject | Retrieves all discounts that are associated with an object (discount type).
Update | Updates a discount.
UpdateAndRetrieve | Updates a discount and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMDiscount.Create Method

The Create method creates a discount object.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal DiscountXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  DiscountXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  DiscountXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct privilege to perform this action. See CUserAuth.
DiscountXml
Specifies the XML string representing a discount. The XML schema is described by discount.xsd.

Return Value

Returns a String type that specifies the ID of the new discount.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscount proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscount  discount = new Microsoft.Crm.Platform.Proxy.CRMDiscount();
discount.Credentials = System.Net.CredentialCache.DefaultCredentials;
discount.Url = strDir + "CRMDiscount.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountTypeId = "{48EAEC97-AK9E-6671-9022-7DKCFBD0F0E3}";

   // Set up the XML string for the discount
   string xml = "<discount>";
   xml += "<discounttypeid>" + strDiscountTypeId + "</discounttypeid>";
   xml += "<lowquantity>1</lowquantity>";
   xml += "<highquantity>10</highquantity>";
   xml += "<percentage>10</percentage>";
   xml += "</discount>";

   // Create the discount
   string strDiscountId = discount.Create(userAuth, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMDiscount Class
  • Update


CRMDiscount.CreateAndRetrieve Method

The CreateAndRetrieve method creates a discount and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InDiscountXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InDiscountXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InDiscountXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct and prvReadProduct privileges to perform this action. See CUserAuth.
InDiscountXml
Specifies the XML string representing a discount. The XML schema is described by discount.xsd.

Return Value

Returns a String type that specifies the XML data representing the new discount. The XML schema is described by discount.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscount proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscount  discount = new Microsoft.Crm.Platform.Proxy.CRMDiscount();
discount.Credentials = System.Net.CredentialCache.DefaultCredentials;
discount.Url = strDir + "CRMDiscount.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountTypeId = "{48EAEC97-AK9E-6671-9022-7DKCFBD0F0E3}";

   // Set up the XML string for the discount
   string xml = "<discount>";
   xml += "<discounttypeid>" + strDiscountTypeId + "</discounttypeid>";
   xml += "<lowquantity>1</lowquantity>";
   xml += "<highquantity>10</highquantity>";
   xml += "<percentage>10</percentage>";
   xml += "</discount>";

   // Create the discount
   string strDiscountXml = discount.CreateAndRetrieve(userAuth, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMDiscount Class
  • UpdateAndRetrieve


CRMDiscount.Delete Method

The Delete method deletes a discount.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal DiscountId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  DiscountId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  DiscountId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteProduct privilege to perform this action. See CUserAuth.
DiscountId
Specifies the ID of the discount that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscount proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscount  discount = new Microsoft.Crm.Platform.Proxy.CRMDiscount();
discount.Credentials = System.Net.CredentialCache.DefaultCredentials;
discount.Url = strDir + "CRMDiscount.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountId = "{94AAEC97-AK9E-8871-2205-5DRGFBD0F0E3}";

   // Delete the discount
   discount.Delete(userAuth, strDiscountId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMDiscount Class


CRMDiscount.Retrieve Method

The Retrieve method retrieves a discount.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal DiscountId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  DiscountId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  DiscountId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
DiscountId
Specifies the ID of the discount that is to be retrieved.
ColumnSetXml
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in discount.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the new discount. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by discount.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscount proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscount  discount = new Microsoft.Crm.Platform.Proxy.CRMDiscount();
discount.Credentials = System.Net.CredentialCache.DefaultCredentials;
discount.Url = strDir + "CRMDiscount.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountId = "{94AAEC97-AK9E-8871-2205-5DRGFBD0F0E3}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>lowquantity</column>";
   strColumnSetXml += "<column>highquantity</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the discount
   string strResultsXml = discount.Retrieve(userAuth, strDiscountId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMDiscount Class
  • RetrieveByObject


CRMDiscount.RetrieveByObject Method

The RetrieveByObject method retrieves all discounts that are associated with an object (discount type).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
Object
Specifies the object (discount type) for which discounts are to be retrieved. See CObjectName.
ColumnSetXml
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in discount.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the new discount. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<discounts> + discount1..N + </discounts>

where the XML schema for each discount is described by discount.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscount proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscount  discount = new Microsoft.Crm.Platform.Proxy.CRMDiscount();
discount.Credentials = System.Net.CredentialCache.DefaultCredentials;
discount.Url = strDir + "CRMDiscount.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountTypeId = "{48EAEC97-AK9E-6671-9022-7DKCFBD0F0E3}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>lowquantity</column>";
   strColumnSetXml += "<column>highquantity</column>";
   strColumnSetXml += "</columnset>";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strDiscountTypeId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otDiscountType;

   // Retrieve discounts by object
   string strResultsXml = discount.RetrieveByObject(userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMDiscount Class
  • Retrieve


CRMDiscount.Update Method

The Update method updates a discount.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal DiscountId As String,
  ByVal DiscountXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  DiscountId,
  string  DiscountXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  DiscountId,
  String*  DiscountXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
DiscountId
Specifies the ID of the discount that is to be updated.
DiscountXml
Specifies the XML string representing a discount. The XML schema is described by discount.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscount proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscount  discount = new Microsoft.Crm.Platform.Proxy.CRMDiscount();
discount.Credentials = System.Net.CredentialCache.DefaultCredentials;
discount.Url = strDir + "CRMDiscount.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountId = "{94AAEC97-AK9E-8871-2205-5DRGFBD0F0E3}";

   // Set up the XML string for the discount
   string xml = "<discount>";
   xml += "<lowquantity>2</lowquantity>";
   xml += "<highquantity 18</highquantity>";
   xml += "<percentage>8</percentage>";
   xml += "</discount>";

   // Update the discount
   discount.Update(userAuth, strDiscountId, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMDiscount Class
  • UpdateAndRetrieve


CRMDiscount.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a discount and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal DiscountId As String,
  ByVal InDiscountXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  DiscountId,
  string  InDiscountXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  DiscountId,
  String*  InDiscountXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct and prvReadProduct privileges to perform this action. See CUserAuth.
DiscountId
Specifies the ID of the discount that is to be updated.
InDiscountXml
Specifies the XML string representing a discount. The XML schema is described by discount.xsd.

Return Value

Returns a String type that specifies the XML data representing the new discount. The XML schema is described by discount.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscount proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscount  discount = new Microsoft.Crm.Platform.Proxy.CRMDiscount();
discount.Credentials = System.Net.CredentialCache.DefaultCredentials;
discount.Url = strDir + "CRMDiscount.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountId = "{94AAEC97-AK9E-8871-2205-5DRGFBD0F0E3}";

   // Set up the XML string for the discount
   string xml = "<discount>";
   xml += "<lowquantity>2</lowquantity>";
   xml += "<highquantity>18</highquantity>";
   xml += "<percentage>8</percentage>";
   xml += "</discount>";

   // Update the discount
   string strResultsXml = discount.UpdateAndRetrieve(userAuth, strDiscountId, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMDiscount Class
  • Update


CRMDiscountType Class

The CRMDiscountType class contains methods that you can use to manage discount types.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMDiscountType
[Visual Basic .NET]
Public Class CRMDiscountType
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMDiscountType : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMDiscountType: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMDiscountType class exposes the following methods.

Method | Description
Activate | Activates a discount type.
Create | Creates a new discount type.
CreateAndRetrieve | Creates a discount type and then retrieves it.
Deactivate | Deactivates a discount type.
Delete | Deletes a discount type.
Retrieve | Retrieves a discount type.
RetrieveByOrganization | Retrieves all discount types that are associated with an organization.
Update | Updates a discount type.
UpdateAndRetrieve | Updates a discount type and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMDiscountType.Activate Method

The Activate method activates a discount type.

Syntax

[Visual Basic .NET]
Public Sub Activate(
  ByVal Caller As CUserAuth,
  ByVal strDiscountTypeId As String,
  ByVal Status As Integer
)
[C#]
public void Activate(
  CUserAuth  Caller,
  string  strDiscountTypeId,
  int  Status
);
[C++]
public: void Activate(
  CUserAuth*  Caller,
  String*  strDiscountTypeId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
DiscountTypeId
Specifies the ID of the discount type that is to be activated.
Status
Specifies the new status of the discount type. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscountType proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscountType  discounttype = new Microsoft.Crm.Platform.Proxy.CRMDiscountType();
discounttype.Credentials = System.Net.CredentialCache.DefaultCredentials;
discounttype.Url = strDir + "CRMDiscounttype.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountTypeId = "{48EAEC97-AK9E-6671-9022-7DKCFBD0F0E3}";

   // Activate the discount type
   discounttype.Activate(userAuth, strDiscountTypeId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMDiscountType Class


CRMDiscountType.Create Method

The Create method creates a discount type.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal DiscountTypeXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  DiscountTypeXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  DiscountTypeXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct privilege to perform this action. See CUserAuth.
DiscountTypeXml
Specifies the XML string representing a discount type. The XML schema is described by discounttype.xsd.

Return Value

Returns a String type that specifies the ID of the new discount type.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscountType proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscountType  discounttype = new Microsoft.Crm.Platform.Proxy.CRMDiscountType();
discounttype.Credentials = System.Net.CredentialCache.DefaultCredentials;
discounttype.Url = strDir + "CRMDiscounttype.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strOrganizationId = "{58EAEC97-AE9E-4471-9062-7D3CFBD0F0E3}";

   // Set up the XML string for the discount type
   string xml = "<discounttype>";
        xml += "<name>Test Discount Type</name>";
        xml += "<organizationid>" + strOrganizationId + "</organizationid>";
        xml += "<description>description 1</description>";
        xml += "</discounttype>";

   // Create the discount type
   string strDiscountTypeId = discounttype.Create(userAuth, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMDiscountType Class
  • Update


CRMDiscountType.CreateAndRetrieve Method

The CreateAndRetrieve method creates a discount type and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InDiscountTypeXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InDiscountTypeXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InDiscountTypeXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct and prvReadProduct privileges to perform this action. See CUserAuth.
InDiscountTypeXml
Specifies the XML string representing a discount type. The XML schema is described by discounttype.xsd.

Return Value

Returns a String type that specifies the XML data representing the new discount type. The XML schema is described by discounttype.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscountType proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscountType  discounttype = new Microsoft.Crm.Platform.Proxy.CRMDiscountType();
discounttype.Credentials = System.Net.CredentialCache.DefaultCredentials;
discounttype.Url = strDir + "CRMDiscounttype.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strOrganizationId = "{58EAEC97-AE9E-4471-9062-7D3CFBD0F0E3}";

   // Set up the XML string for the discount type
   string xml = "<discounttype>";
   xml += "<name>Test Discount Type</name>";
   xml += "<organizationid>" + strOrganizationId + "</organizationid>";
   xml += "<description>description 1</description>";
   xml += "</discounttype>";

   // Create and then retrieve the discount type
   string strResultXml = discounttype.CreateAndRetrieve(userAuth, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMDiscountType Class
  • UpdateAndRetrieve


CRMDiscountType.Deactivate Method

The Deactivate method deactivates a discount type.

Syntax

[Visual Basic .NET]
Public Sub Deactivate(
  ByVal Caller As CUserAuth,
  ByVal strDiscountTypeId As String,
  ByVal Status As Integer
)
[C#]
public void Deactivate(
  CUserAuth  Caller,
  string  strDiscountTypeId,
  int  Status
);
[C++]
public: void Deactivate(
  CUserAuth*  Caller,
  String*  strDiscountTypeId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
DiscountTypeId
Specifies the ID of the discount type that is to be inactivated.
Status
Specifies the new status for the discount type. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscountType proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscountType  discounttype = new Microsoft.Crm.Platform.Proxy.CRMDiscountType();
discounttype.Credentials = System.Net.CredentialCache.DefaultCredentials;
discounttype.Url = strDir + "CRMDiscounttype.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountTypeId = "{48EAEC97-AK9E-6671-9022-7DKCFBD0F0E3}";

   // Deactivate the discount type
   discounttype.Deactivate(userAuth, strDiscountTypeId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMDiscountType Class


CRMDiscountType.Delete Method

The Delete method deletes a discount type.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal strDiscountTypeId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  strDiscountTypeId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  strDiscountTypeId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteProduct privilege to perform this action. See CUserAuth.
DiscountTypeId
Specifies the ID of the discount type that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscountType proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscountType  discounttype = new Microsoft.Crm.Platform.Proxy.CRMDiscountType();
discounttype.Credentials = System.Net.CredentialCache.DefaultCredentials;
discounttype.Url = strDir + "CRMDiscounttype.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountTypeId = "{48EAEC97-AK9E-6671-9022-7DKCFBD0F0E3}";

   // Delete the discount type
   discounttype.Delete(userAuth, strDiscountTypeId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMDiscountType Class


CRMDiscountType.Retrieve Method

The Retrieve method retrieves a discount type.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal strDiscountTypeId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  strDiscountTypeId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  strDiscountTypeId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
DiscountTypeId
Specifies the ID of the discount type that is to be retrieved.
ColumnSetXml
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in discounttype.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the discount type. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by discounttype.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscountType proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscountType  discounttype = new Microsoft.Crm.Platform.Proxy.CRMDiscountType();
discounttype.Credentials = System.Net.CredentialCache.DefaultCredentials;
discounttype.Url = strDir + "CRMDiscounttype.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountTypeId = "{48EAEC97-AK9E-6671-9022-7DKCFBD0F0E3}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the discount type
   string strResultsXml = discounttype.Retrieve (userAuth, strDiscountTypeId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMDiscountType Class
  • RetrieveByOrganization


CRMDiscountType.RetrieveByOrganization Method

The RetrieveByOrganization method retrieves all discount types that are associated with an organization.

Syntax

[Visual Basic .NET]
Public Function RetrieveByOrganization(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal StateCodes As Integer(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByOrganization(
  CUserAuth  Caller,
  string  OrganizationId,
  int[]  StateCodes,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByOrganization(
  CUserAuth*  Caller,
  String*  OrganizationId,
  long  StateCodes __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
StateCodes
Specifies an array of states to find. See DISCOUNT_TYPE_STATE.
ColumnSetXml
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in discounttype.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of discount types associated with the specified organization. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<discounttypes> + discounttype1..N + </discounttypes>

where the XML schema for each discount type is described by discounttype.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscountType proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscountType  discounttype = new Microsoft.Crm.Platform.Proxy.CRMDiscountType();
discounttype.Credentials = System.Net.CredentialCache.DefaultCredentials;
discounttype.Url = strDir + "CRMDiscounttype.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strOrganizationId = "{58EAEC97-AE9E-4471-9062-7D3CFBD0F0E3}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   int[] arrCodes = new int[] {Microsoft.Crm.Platform.Types.DISCOUNT_TYPE_STATE .DTS_ACTIVE};

   // Retrieve the discount type by organization
   string strResultsXml = discounttype.RetrieveByOrganization(userAuth, strOrganizationId, arrCodes, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMDiscountType Class
  • Retrieve


CRMDiscountType.Update Method

The Update method updates a discount type.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal strDiscountTypeId As String,
  ByVal DiscountTypeXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  strDiscountTypeId,
  string  DiscountTypeXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  strDiscountTypeId,
  String*  DiscountTypeXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
DiscountTypeId
Specifies the ID of the discount type that is to be updated.
DiscountTypeXml
Specifies the XML string representing a discount type. The XML schema is described by discounttype.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscountType proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscountType  discounttype = new Microsoft.Crm.Platform.Proxy.CRMDiscountType();
discounttype.Credentials = System.Net.CredentialCache.DefaultCredentials;
discounttype.Url = strDir + "CRMDiscounttype.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountTypeId = "{48EAEC97-AK9E-6671-9022-7DKCFBD0F0E3}";

   // Set up the XML string for the discount type
   string xml = "<discounttype>";
   xml += "<name>Test Discount Type 1</name>";
   xml += "<description>description 2</description>";
   xml += "</discounttype>";

   // Update the discount type
   discounttype.Update(userAuth, strDiscountTypeId, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMDiscountType Class
  • UpdateAndRetrieve


CRMDiscountType.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates and then retrieves a discount type.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal strDiscountTypeId As String,
  ByVal InDiscountTypeXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  strDiscountTypeId,
  string  InDiscountTypeXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  strDiscountTypeId,
  String*  InDiscountTypeXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct and prvReadProduct privileges to perform this action. See CUserAuth.
DiscountTypeId
Specifies the ID of the discount type that is to be updated.
InDiscountTypeXml
Specifies the XML string representing a discount type. The XML schema is described by discounttype.xsd.

Return Value

Returns a String type that specifies the XML data representing the discount type. The XML schema is described by discounttype.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMDiscountType proxy object
Microsoft.Crm.Platform.Proxy.CRMDiscountType  discounttype = new Microsoft.Crm.Platform.Proxy.CRMDiscountType();
discounttype.Credentials = System.Net.CredentialCache.DefaultCredentials;
discounttype.Url = strDir + "CRMDiscounttype.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strDiscountTypeId = "{48EAEC97-AK9E-6671-9022-7DKCFBD0F0E3}";

   // Set up the XML string for the discount type
   string xml = "<discounttype>";
   xml += "<name>Test Discount Type 1</name>";
   xml += "<description>description 2</description>";
   xml += "</discounttype>";

   // Update and then retrieve the discount type
   string strResultsXml = discounttype.UpdateAndRetrieve(userAuth, strDiscountTypeId, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMDiscountType Class
  • Update


CRMEmail Class

The CRMEmail class contains methods you can use to manage e-mail.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMEmail
[Visual Basic .NET]
Public Class CRMEmail
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMEmail : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMEmail: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMEmail class exposes the following methods.

Method | Description
CheckIncoming | Checks whether the incoming e-mail message is relevant to the Microsoft CRM system.
Create | Creates an e-mail object.
CreateAndRetrieve | Creates an e-mail object and then retrieves it.
Delete | Deletes an e-mail object and all attachments.
DeliverIncoming | Routes the e-mail object to the appropriate set of system users or contacts.
DetachFromQueue | Detaches the e-mail object from the specified queue.
GrantAccess | Shares an e-mail object with the specified security principal.
ModifyAccess | Modifies the access rights on the e-mail object for the specified security principal.
Retrieve | Retrieves an e-mail object.
RetrieveByObject | Retrieves the e-mail object that is associated with the specified object.
RetrieveByPrincipal | Retrieves the messages that are owned by the specified security principal.
RevokeAccess | Revokes access to the e-mail object for a specified security principal.
Send | Sends a new e-mail message.
SendById | Sends an existing e-mail message.
Update | Updates an e-mail object.
UpdateAndRetrieve | Updates an e-mail object and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMEmail.CheckIncoming Method

The CheckIncoming method checks whether the incoming e-mail message is relevant to the Microsoft CRM system.

Syntax

[Visual Basic .NET]
Public Function CheckIncoming(
  ByVal Recipients As String
) As Integer
[C#]
public int CheckIncoming(
  string  Recipients
);
[C++]
public: long CheckIncoming(
  String*  Recipients
);

Parameters

Recipients
Specifies an XML string describing the sender and the recipients of the e-mail message. The XML schema is described by activityparty.xsd.

Return Value

Returns an Int32 type that specifies true if there is at least one user found with ignoreunsolicitedemail set to false or a if a queue has incoming e-mail messages. Otherwise this method returns false. (You can find ignoreunsolicitedemail in usersettings.xsd.)

Note For more information about incoming e-mail, see "Sending and Receiving E-mail in Microsoft CRM Sales for Outlook" in Microsoft CRM Help.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMActivity proxy object
Microsoft.Crm.Platform.Proxy.CRMActivity activity = new Microsoft.Crm.Platform.Proxy.CRMActivity ();
activity.Credentials = System.Net.CredentialCache.DefaultCredentials;
activity.Url = strDir + "CRMActivity.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

      // Set up the XML string for the activity parties
      string strPartiesXml = "<activityparties>";
      strPartiesXml += "<activityparty>";
      strPartiesXml += "<addressused>jose@adventure-works.com</addressused>";
      strPartiesXml += "<partyobjecttypecode>" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString(); + "</partyobjecttypecode>";
      strPartiesXml += "<participationtypemask>";
      strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_CC_RECIPIENT.ToString();
      strPartiesXml += "</participationtypemask>";
      strPartiesXml += "</activityparty>";
      strPartiesXml += "</activityparties>";

      // Now check incoming e-mail
      int checkin = email.CheckIncoming(strPartiesXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );

}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmail Class


CRMEmail.Create Method

The Create method creates an e-mail object.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal EmailXml As String,
  ByVal RecipientsXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  EmailXml,
  string  RecipientsXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  EmailXml,
  String*  RecipientsXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateActivity privilege to perform this action. See CUserAuth.
EmailXml
Specifies an XML string describing the e-mail object. The XML schema is described by emailactivity.xsd.
RecipientsXml
Specifies an XML string describing the sender and the recipients of the e-mail object. The XML schema is described by activityparty.xsd.

Return Value

Returns a String type that specifies the ID of the new e-mail object.

Remarks

Currently, you must include a partytype within the XML element calendarparty element if you want to map the recipient to an actual object. You must also provide an e-mail address. (See the example below.)

The valid values for the enumeration are as follows:

0 = ordinary recipient (e-mail address only)
1 = account
2 = contact
4 = lead
7 = user
8 = team

[E-mail activity XML data]

<emailactivity>
   <messagesubject> Test Email </messagesubject>
   <messagebody> Test Email </messagebody>
</emailactivity>

[Recipient XML data]

<activityparties>
   <activityparty>

// (Optional. Overriden during creation of the new e-mail object by the e-mail address
// of the specified recipient)
      <addressused>angela@adventure-works.com</addressused>

       <partyobjecttype> + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() +  </partyobjecttype>
       <partyid>{guid here} </partyid>

       <participationtypemask> + Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_TO_RECIPIENT.ToString() + </participationtypemask>
    </activityparty>
</activityparties>

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

      // Set up the XML string for the activity
      string strActivityXml = "<emailactivity>";
      strActivityXml += "<messagesubject> Test Email </messagesubject>";
      strActivityXml += "<messagebody> Test Email </messagebody>";
      strActivityXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
      strActivityXml += userAuth.UserId + "</ownerid>";
      strActivityXml += "</emailactivity>";

      // Set up the XML string for the activity parties
      string strPartiesXml = "<activityparties>";
      strPartiesXml += "<activityparty>";
      strPartiesXml += "<addressused>eric@adventure-works.com</addressused>";
      strPartiesXml += "<partyobjecttypecode>" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + "</partyobjecttypecode>";
      strPartiesXml += "<partyid>"+ strContactId  + "</partyid>";
      strPartiesXml += "<participationtypemask>";
      strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_TO_RECIPIENT.ToString();
      strPartiesXml += "</participationtypemask>";
      strPartiesXml += "</activityparty>";
      strPartiesXml += "</activityparties>";

      // Create the e-mail object
      string strEmailId = email.Create(userAuth, strActivityXml, strPartiesXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMEmail Class
  • Update


CRMEmail.CreateAndRetrieve Method

The CreateAndRetrieve method creates an e-mail object and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal EmailXml As String,
  ByVal RecipientsXml As String,
  ByRef OutRecipientsXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  EmailXml,
  string  RecipientsXml,
  out string  OutRecipientsXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  EmailXml,
  String*  RecipientsXml,
  String**  OutRecipientsXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateActivity and prvReadActivity privileges to perform this action. See CUserAuth.
EmailXml
Specifies an XML string describing the e-mail object. The XML schema is described by emailactivity.xsd.
RecipientsXml
Specifies an XML string describing the sender and the recipients of the e-mail object. The XML schema is described by activityparty.xsd.
OutRecipientsXml
[out] Specifies the updated XML string describing the sender and the recipients of the e-mail object. The XML schema is described by activityparty.xsd.

Return Value

Returns a String type that specifies the XML data describing the e-mail object. The XML schema is described by emailactivity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the activity
   string strActivityXml = "<emailactivity>";
   strActivityXml += "<messagesubject>Test Email</messagesubject>";
   strActivityXml += "<messagebody>Test Email</messagebody>";
   strActivityXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strActivityXml += userAuth.UserId + "</ownerid>";
   strActivityXml += "</emailactivity>";

   // Set up the XML string for the activity parties
   string strPartiesXml = "<activityparties>";
   strPartiesXml += "<activityparty>";
   strPartiesXml += "<addressused>heidi@adventure-works.com</addressused>";
   strPartiesXml += "<partyobjecttypecode>" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + "</partyobjecttypecode>";
   strPartiesXml += "<partyid>"+ strContactId  + "</partyid>";
   strPartiesXml += "<participationtypemask>";
   strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_TO_RECIPIENT.ToString();
   strPartiesXml += "</participationtypemask>";
   strPartiesXml += "</activityparty>";
   strPartiesXml += "</activityparties>";

   // Create the e-mail object, and then retrieve it
   string strEmailXml = email.CreateAndRetrieve(userAuth, strActivityXml, strPartiesXml, out strPartiesXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMEmail Class
  • UpdateAndRetrieve


CRMEmail.Delete Method

The Delete method deletes the specified e-mail object and all attachments.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal EmailId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  EmailId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  EmailId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteActivity privilege to perform this action. See CUserAuth.
EmailId
Specifies the ID of the e-mail object that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strEmailId = "{391B302C-E2F8-4E19-83E2-3B2D291B4E31}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the e-mail object
   email.Delete(userAuth, strEmailId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmail Class


CRMEmail.DeliverIncoming Method

The DeliverIncoming method routes the e-mail object to the appropriate set of system users or contacts.

Syntax

[Visual Basic .NET]
Public Sub DeliverIncoming(
  ByVal RegardingInfo As String,
  ByVal Recipients As String,
  ByVal MimeMessage As String
)
[C#]
public void DeliverIncoming(
  string  RegardingInfo,
  string  Recipients,
  string  MimeMessage
);
[C++]
public: void DeliverIncoming(
  String*  RegardingInfo,
  String*  Recipients,
  String*  MimeMessage
);

Parameters

RegardingInfo
Specifies an XML string containing the regarding information.
Recipients
Specifies an XML string containing the recipients of the e-mail object.
MimeMessage
Specifies an XML string containing the MIME e-mail message.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strRegInfo = "Test delivery of e-mail";
string strMailBody = "This is the e-mail body contents.";
string strEmailAddress = "luis@adventure-works.com";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Deliver the incoming e-mail
   email.DeliverIncoming(strRegInfo, strEmailAddress, strMailBody);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );

}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmail Class


CRMEmail.DetachFromQueue Method

The DetatchFromQueue method detaches the e-mail object from the specified queue.

Syntax

[Visual Basic .NET]
Public Sub DetachFromQueue(
  ByVal Caller As CUserAuth,
  ByVal EmailId As String,
  ByVal QueueId As String
)
[C#]
public void DetachFromQueue(
  CUserAuth  Caller,
  string  EmailId,
  string  QueueId
);
[C++]
public: void DetachFromQueue(
  CUserAuth*  Caller,
  String*  EmailId,
  String*  QueueId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteQueue privilege to perform this action. See CUserAuth.
EmailId
Specifies the ID of the e-mail object that is to be detached from its queue.
QueueId
Specifies the ID of the queue.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strQueueId = "{D985D31D-3C83-4FAD-BDE4-404565615CBA}";
string strEmailId = "{391B302C-E2F8-4E19-83E2-3B2D291B4E31}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Detach the e-mail object from the queue
   email.DetachFromQueue(userAuth, strEmailId, strQueueId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );

}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmail Class


CRMEmail.GrantAccess Method

The GrantAccess method grants a security principal access to the specified e-mail object. This method also applies to all child objects of the e-mail object. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the e-mail object. In this case, only the lack of privileges for a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub GrantAccess(
  ByVal Caller As CUserAuth,
  ByVal EmailId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void GrantAccess(
  CUserAuth  Caller,
  string  EmailId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void GrantAccess(
  CUserAuth*  Caller,
  String*  EmailId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareActivity privilege to perform this action. See CUserAuth.
EmailId
Specifies the ID of the e-mail object that is to be shared.
Rights
Specifies the rights that are to be granted to the specified security principal. See ACCESSRIGHTS.
Grantee
Specifies the security principal (user or team) with which the e-mail is to be shared. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_WRITE;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Grant access to the e-mail object
   email.GrantAccess(userAuth, strActivityId, rights, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );

}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmail Class


CRMEmail.ModifyAccess Method

The ModifyAccess method replaces the access rights on the e-mail object for the specified security principal. This method also applies to all child objects of the e-mail object. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the e-mail object. In this case, only the lack of privileges to a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub ModifyAccess(
  ByVal Caller As CUserAuth,
  ByVal EmailId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void ModifyAccess(
  CUserAuth  Caller,
  string  EmailId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void ModifyAccess(
  CUserAuth*  Caller,
  String*  EmailId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvShareActivity privilege to perform this action. See CUserAuth.
EmailId
Specifies the ID of the e-mail object.
Rights
Specifies the set of rights to be granted to the specified security principal . See ACCESSRIGHTS.
Grantee
Specifies the team or user that is to be granted access to the e-mail object. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_DELETE;
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Modify access to the e-mail object
   email.ModifyAccess(userAuth, strActivityId, rights, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );

}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmail Class


CRMEmail.Retrieve Method

The Retrieve method retrieves an e-mail object.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal EmailId As String,
  ByVal ColumnsetXml As String,
  ByRef RecipientsXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  EmailId,
  string  ColumnsetXml,
  out string  RecipientsXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  EmailId,
  String*  ColumnsetXml,
  String**  RecipientsXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
EmailId
Specifies the ID of the e-mail object that is to be retrieved.
ColumnsetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in emailactivity.xsd. See also ColumnSetXML Schema.
RecipientsXml
[out] Specifies an XML string describing the sender and the recipients of the e-mail object. The XML schema is described by activityparty.xsd.

Return Value

Returns a String type that specifies the XML data describing the e-mail object. The XML schema is described by emailactivity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strEmailId = "{391B302C-E2F8-4E19-83E2-3B2D291B4E31}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strPartiesXml = "";

   // Retrieve the XML data for the e-mail object
   string strEmailActivityXml = email.Retrieve(userAuth, strEmailId, "", out strPartiesXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmail Class
  • RetrieveByObject
  • RetrieveByPrincipal


CRMEmail.RetrieveByObject Method

The RetrieveByObject method retrieves the e-mail objects that are associated with the specified object (account).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
Object
Specifies the object for which e-mail objects are to be retrieved. See CObjectName.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in emailactivity.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data describing the set of e-mail objects associated with the specified object. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<emailactivities> + emailactivity1..N + </emailactivities>

where the XML schema for each e-mail object is described by emailactivity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>activityid</column>";
   strColumnSetXml += "<column>partyid</column>";
   strColumnSetXml += "<column>addressused</column>";
   strColumnSetXml += "</columnset>";

   // Create a contact object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strContactId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otContact;

   // Retrieve all of the e-mail objects for the specified object
   string strResultsXml = email.RetrieveByObject(userAuth, objName, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );

}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmail Class
  • Retrieve


CRMEmail.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves the messages that are owned by the specified security principal.

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal Principal As CSecurityPrincipal,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  Principal,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  Principal,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity privilege to perform this action. See CUserAuth.
Principal
Specifies the security principal for which e-mail objects are to be retrieved. See CSecurityPrincipal.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in emailactivity.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data describing the set of e-mail objects associated with the specified security principal. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<emailactivities> + emailactivity1..N + </emailactivities>

where the XML schema for each e-mail object is described by emailactivity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strEmailId = "{391B302C-E2F8-4E19-83E2-3B2D291B4E31}";
uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_WRITE;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Grant access to the e-mail object
   email.GrantAccess(userAuth, strEmailId, rights, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );

}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmail Class
  • Retrieve


CRMEmail.RevokeAccess Method

The RevokeAccess method revokes access rights to the e-mail object for the specified security principal. This method also applies to all child objects of the e-mail object. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the e-mail object. In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

Syntax

[Visual Basic .NET]
Public Sub RevokeAccess(
  ByVal Caller As CUserAuth,
  ByVal EmailId As String,
  ByVal Revokee As CSecurityPrincipal
)
[C#]
public void RevokeAccess(
  CUserAuth  Caller,
  string  EmailId,
  CSecurityPrincipal  Revokee
);
[C++]
public: void RevokeAccess(
  CUserAuth*  Caller,
  String*  EmailId,
  CSecurityPrincipal*  Revokee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareActivity privilege to perform this action. See CUserAuth.
EmailId
Specifies the ID of the e-mail object for which access is to be revoked.
Revokee
Specifies the security principal (user or team) whose access is to be revoked. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strEmailId = "{391B302C-E2F8-4E19-83E2-3B2D291B4E31}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Revoke access to the e-mail object
   email.RevokeAccess(userAuth, strEmailId, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );

}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmail Class


CRMEmail.Send Method

The Send method sends a new e-mail message.

Syntax

[Visual Basic .NET]
Public Function Send(
  ByVal Caller As CUserAuth,
  ByVal EmailXml As String,
  ByVal RecipientsXml As String
) As String
[C#]
public string Send(
  CUserAuth  Caller,
  string  EmailXml,
  string  RecipientsXml
);
[C++]
public: String* Send(
  CUserAuth*  Caller,
  String*  EmailXml,
  String*  RecipientsXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity and prvWriteActivity privileges to perform this action. See CUserAuth.
EmailXml
Specifies an XML string describing the e-mail message. The XML schema is described by emailactivity.xsd.
RecipientsXml
Specifies an XML string describing the sender and the recipients of the e-mail message. The XML schema is described by activityparty.xsd.

Return Value

Returns a String type that specifies the ID of the e-mail object.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the activity
   string strActivityXml = "<emailactivity>";
   strActivityXml += "<messagesubject>Test Email</messagesubject>";
   strActivityXml += "<messagebody>Test Email</messagebody>";
   strActivityXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strActivityXml += userAuth.UserId + "</ownerid>";
   strActivityXml += "</emailactivity>";

   // Set up the XML string for the activity parties
   string strPartiesXml = "<activityparties>";
   strPartiesXml += "<activityparty>";
   strPartiesXml += "<addressused>maciej@adventure-works.com</addressused>";
   strPartiesXml += "<partyobjecttypecode>" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + "</partyobjecttypecode>";
   strPartiesXml += "<partyid>"+ strContactId  + "</partyid>";
   strPartiesXml += "<participationtypemask>";
   strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_TO_RECIPIENT.ToString();
   strPartiesXml += "</participationtypemask>";
   strPartiesXml += "</activityparty>";
   strPartiesXml += "</activityparties>";

   // Send the e-mail object
   string strEmailId = email.Send (userAuth, strActivityXml, strPartiesXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmail Class
  • SendById


CRMEmail.SendById Method

The SendById method sends an existing e-mail message.

Syntax

[Visual Basic .NET]
Public Sub SendById(
  ByVal Caller As CUserAuth,
  ByVal EmailId As String
)
[C#]
public void SendById(
  CUserAuth  Caller,
  string  EmailId
);
[C++]
public: void SendById(
  CUserAuth*  Caller,
  String*  EmailId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadActivity and prvWriteActivity privileges to perform this action. See CUserAuth.
EmailId
Specifies the ID of the e-mail message that is to be sent.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strEmailId ="{ 391B302C-E2F8-4E19-83E2-3B2D291B4E31}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now send the e-mail object
   email.SendById(userAuth, strEmailId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );

}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmail Class
  • Send


CRMEmail.Update Method

The Update method updates an e-mail object.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal EmailId As String,
  ByVal EmailXml As String,
  ByVal RecipientsXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  EmailId,
  string  EmailXml,
  string  RecipientsXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  EmailId,
  String*  EmailXml,
  String*  RecipientsXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity privilege to perform this action. See CUserAuth.
EmailId
Specifies the ID of the e-mail object that is to be updated.
EmailXml
Specifies an XML string describing the e-mail object. The XML schema is described by emailactivity.xsd.
RecipientXml
Specifies an XML string describing the sender and the recipients of the e-mail object. The XML schema is described by activityparty.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strEmailId = "{391B302C-E2F8-4E19-83E2-3B2D291B4E31}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the activity
   string strActivityXml = "<emailactivity>";
   strActivityXml += "<messagesubject>Test Email 1</messagesubject>";
   strActivityXml += "<messagebody>Test Email 1</messagebody>";
   strActivityXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strActivityXml += userAuth.UserId + "</ownerid>";
   strActivityXml += "</emailactivity>";

   // Set up the XML string for the activity parties
   string strPartiesXml = "<activityparties>";
   strPartiesXml += "<activityparty>";
   strPartiesXml += "<addressused>zheng@adventure-works.com</addressused>";
   strPartiesXml += "<partyobjecttypecode>" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + "</partyobjecttypecode>";
   strPartiesXml += "<participationtypemask>";
   strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_CC_RECIPIENT.ToString();
   strPartiesXml += "</participationtypemask>";
   strPartiesXml += "</activityparty>";
   strPartiesXml += "</activityparties>";

   // Now update the e-mail object
   email.Update(userAuth, strEmailId, strActivityXml, strPartiesXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );

}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMEmail Class
  • UpdateAndRetrieve


CRMEmail.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an e-mail object and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal EmailId As String,
  ByVal EmailXml As String,
  ByVal RecipientsXml As String,
  ByRef OutRecipientsXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  EmailId,
  string  EmailXml,
  string  RecipientsXml,
  out string  OutRecipientsXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  EmailId,
  String*  EmailXml,
  String*  RecipientsXml,
  String**  OutRecipientsXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteActivity and prvReadActivity privileges to perform this action. See CUserAuth.
EmailId
Specifies the ID of the e-mail object that is to be updated.
EmailXml
Specifies an XML string describing the e-mail object. The XML schema is described by emailactivity.xsd.
RecipientXml
Specifies an XML string describing the sender and the recipients of the e-mail object. The XML schema is described by activityparty.xsd.
OutRecipientsXml
[out] Specifies an XML string describing the sender and the recipients of the e-mail object. The XML schema is described by activityparty.xsd.

Return Value

Returns a String type that specifies the XML data describing the e-mail object. The XML schema is described by emailactivity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmail proxy object
Microsoft.Crm.Platform.Proxy.CRMEmail email = new Microsoft.Crm.Platform.Proxy.CRMEmail();
email.Credentials = System.Net.CredentialCache.DefaultCredentials;
email.Url = strDir + "CRMEmail.srf";

string strErrorMsg;
string strEmailId = "{391B302C-E2F8-4E19-83E2-3B2D291B4E31}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the activity
   string strActivityXml = "<emailactivity>";
   strActivityXml += "<messagesubject>Test Email 1</messagesubject>";
   strActivityXml += "<messagebody>Test Email 1</messagebody>";
   strActivityXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strActivityXml += userAuth.UserId + "</ownerid>";
   strActivityXml += "</emailactivity>";

   // Set up the XML string for the activity parties
   string strPartiesXml = "<activityparties>";
   strPartiesXml += "<activityparty>";
   strPartiesXml += "<addressused>rachel@adventure-works.com</addressused>";
   strPartiesXml += "<partyobjecttypecode>" + Microsoft.Crm.Platform.Types.ObjectType.otContact.ToString() + "</partyobjecttypecode>";
   strPartiesXml += "<participationtypemask>";
   strPartiesXml += Microsoft.Crm.Platform.Types.ACTIVITY_PARTY_TYPE.ACTIVITY_PARTY_CC_RECIPIENT.ToString();
   strPartiesXml += "</participationtypemask>";
   strPartiesXml += "</activityparty>";
   strPartiesXml += "</activityparties>";

   // Now update the e-mail object
   string strResultsXml = email.UpdateAndRetrieve(userAuth, strEmailId, strActivityXml, strPartiesXml, out strPartiesXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );

}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMEmail Class
  • Update


CRMEmailTemplate Class

The CRMEmailTemplate class contains methods that you can use to manage e-mail templates.

There are no properties for this class.

Note You can create a structure for the e-mail template that is meaningful for the application that you are creating. These templates do not work with the Microsoft CRM application, which uses a proprietary e-mail template format.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMEmailTemplate
[Visual Basic .NET]
Public Class CRMEmailTemplate
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMEmailTemplate : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMEmailTemplate: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMEmailTemplate class exposes the following methods.

Method | Description
Assign | Assigns the template to a new owner.
Create | Creates a personal e-mail template.
CreateAndRetrieve | Creates a personal e-mail template and then retrieves it.
Delete | Deletes a personal e-mail template.
Instantiate | Creates an e-mail message from a template.
MakeAvailableToOrganization | Makes the specified e-mail template available to the entire organization.
MakePrivate | Makes a template private.
MakePublic | Makes a template public.
MakeUnvailableToOrganization | Makes the specified e-mail template no longer available to the entire organization.
Retrieve | Retrieves a personal e-mail template.
RetrieveByPrincipal | Retrieves all templates that are owned by a security principal (user or team).
RetrievePrincipalAccess | Retrieves the access rights the security principal has for the specified e-mail template.
Send | Sends a bulk e-mail message that was created from a template.
Update | Updates a personal e-mail template.
UpdateAndRetrieve | Updates a personal e-mail template and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMEmailTemplate.Assign Method

The Assign method assigns the e-mail template to a security principal (user or team). (See Remarks.) This method also applies to the parent object and associated objects that have the same owner as the parent object. Therefore when you assign the parent object to a new owner, only the associated objects that have the same owner as the parent object are assigned. In addition, when an object is assigned to a new owner, it is shared with the previous owner with full rights. Either the new owner or the previous owner can remove the relationship or lower the level of privileges the previous owner had on the object.

Syntax

[Visual Basic .NET]
Public Sub Assign(
  ByVal Caller As CUserAuth,
  ByVal TemplateId As String,
  ByVal Assignee As CSecurityPrincipal
)
[C#]
public void Assign(
  CUserAuth  Caller,
  string  TemplateId,
  CSecurityPrincipal  Assignee
);
[C++]
public: void Assign(
  CUserAuth*  Caller,
  String*  TemplateId,
  CSecurityPrincipal*  Assignee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignEmailTemplate privilege to perform this action. See CUserAuth.
TemplateId
Specifies the ID of the template.
Assignee
Specifies the new owner of the e-mail template. It can be a user or a team. See CSecurityPrincipal.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not support business object assignment to teams.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate  emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
string strEmailTemplateId = "{586D80AA-3E9B-4936-ABCA-2C4EB37FBE82}";

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Now assign the e-mail template to another security principal
   emailtemplate.Assign(userAuth, strEmailTemplateId, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmailTemplate Class


CRMEmailTemplate.Create Method

The Create method creates a personal e-mail template.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal TemplateXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  TemplateXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  TemplateXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateEmailTemplate privilege to perform this action. See CUserAuth.
TemplateXml
Specifies an XML string describing the e-mail template. The XML schema is described by template.xsd.

Return Value

Returns a String type that specifies the ID of the new template.

Remarks

Note Create a value for the presentationxml field that is meaningful for your application. These templates do not work with the Microsoft CRM application, which uses a proprietary e-mail template format.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate  emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the e-mail template
   string strXmlTemplate = "<template>";
   strXmlTemplate += "<subject>A Template Subject</subject>";
   strXmlTemplate += "<templatetypecode>1</templatetypecode>";
   strXmlTemplate += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strXmlTemplate += userAuth.UserId + "</ownerid>";
   strXmlTemplate += "</template>";

   string strEmailTemplateId = emailtemplate.Create(userAuth, strXmlTemplate);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMEmailTemplate Class
  • Update


CRMEmailTemplate.CreateAndRetrieve Method

The CreateAndRetrieve method creates a personal e-mail template and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal TemplateXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  TemplateXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  TemplateXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateEmailTemplate and prvReadEmailTemplate privileges to perform this action. See CUserAuth.
TemplateXml
Specifies an XML string describing the e-mail template. The XML schema is described by template.xsd.

Return Value

Returns a String type that specifies the XML data containing the template. The XML schema is described by template.xsd.

Remarks

Note Create a value for the presentationxml field that is meaningful for your application. These templates do not work with the Microsoft CRM application, which uses a proprietary e-mail template format.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate  emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the e-mail template
   string strXmlTemplate = "<template>";
   strXmlTemplate += "<subject>A Template Subject</subject>";
   strXmlTemplate += "<templatetypecode>1</templatetypecode>";
   strXmlTemplate += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strXmlTemplate += userAuth.UserId + "</ownerid>";
   strXmlTemplate += "</template>";

   // Create the e-mail template, and then retrieve it
   string strResultsXml = emailtemplate.CreateAndRetrieve(userAuth, strXmlTemplate);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMEmailTemplate Class
  • UpdateAndRetrieve


CRMEmailTemplate.Delete Method

The Delete method deletes a personal e-mail template.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal TemplateId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  TemplateId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  TemplateId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteEmailTemplate privilege to perform this action. See CUserAuth.
TemplateId
Specifies the ID of the template that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
string strEmailTemplateId = "{586D80AA-3E9B-4936-ABCA-2C4EB37FBE82}";

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the template
   emailtemplate.Delete(userAuth, strEmailTemplateId );

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmailTemplate Class


CRMEmailTemplate.Instantiate Method

The Instantiate method creates an e-mail message from a template.

Syntax

[Visual Basic .NET]
Public Function Instantiate(
  ByVal Caller As CUserAuth,
  ByVal TemplateId As String,
  ByVal Type As ObjectType,
  ByVal ObjectId As String
) As String
[C#]
public string Instantiate(
  CUserAuth  Caller,
  string  TemplateId,
  ObjectType  Type,
  string  ObjectId
);
[C++]
public: String* Instantiate(
  CUserAuth*  Caller,
  String*  TemplateId,
  ObjectType  Type,
  String*  ObjectId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadEmailTemplate privilege to perform this action. See CUserAuth.
TemplateId
Specifies the ID of the template.
Type
Specifies the type of the object. See ObjectType.
ObjectId
Specifies the ID of the object.

Return Value

Returns a String type that specifies the XML data containing the template.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate  emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
string strEmailTemplateId = "{586D80AA-3E9B-4936-ABCA-2C4EB37FBE82}";
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Instantiate the e-mail template
   string strResults = emailtemplate.Instantiate(userAuth, strEmailTemplateId, Microsoft.Crm.Platform.Proxy.ObjectType.otAccount, strAccountId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmailTemplate Class


CRMEmailTemplate.MakeAvailableToOrganization Method

The MakeAvailableToOrganization method makes the specified e-mail template available to the entire organization.

Syntax

[Visual Basic .NET]
Public Sub MakeAvailableToOrganization(
  ByVal Caller As CUserAuth,
  ByVal TemplateId As String
)
[C#]
public void MakeAvailableToOrganization(
  CUserAuth  Caller,
  string  TemplateId
);
[C++]
public: void MakeAvailableToOrganization(
  CUserAuth*  Caller,
  String*  TemplateId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateOrgEmailTemplates privilege to perform this action. See CUserAuth.
TemplateId
Specifies the ID of the template that is to be made available.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate  emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
string strEmailTemplateId = "{586D80AA-3E9B-4936-ABCA-2C4EB37FBE82}";

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make the e-mail template available to the organization
   emailtemplate.MakeAvailableToOrganization (userAuth, strEmailTemplateId );

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmailTemplate Class
  • MakeUnvailableToOrganization


CRMEmailTemplate.MakePrivate Method

The MakePrivate method makes the template unavailable to anyone except the owner and the users that share the object. Only the owner of a template can make it private. By default, all objects are public. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub MakePrivate(
  ByVal Caller As CUserAuth,
  ByVal TemplateId As String
)
[C#]
public void MakePrivate(
  CUserAuth  Caller,
  string  TemplateId
);
[C++]
public: void MakePrivate(
  CUserAuth*  Caller,
  String*  TemplateId
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvWriteEmailTemplate privilege to perform this action. See CUserAuth.
TemplateId
Specifies the ID of the template that is to be made private.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for using the MakePrivate method. However, if you use this method through a third-party solution, the application recognizes that setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
string strEmailTemplateId = "{586D80AA-3E9B-4936-ABCA-2C4EB37FBE82}";
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make the template private
   emailtemplate.MakePrivate(userAuth, strEmailTemplateId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmailTemplate Class
  • MakePublic


CRMEmailTemplate.MakePublic Method

The MakePublic method makes an e-mail template available to all users. Only the owner of a template can make it public. By default, all objects are public. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub MakePublic(
  ByVal Caller As CUserAuth,
  ByVal TemplateId As String
)
[C#]
public void MakePublic(
  CUserAuth  Caller,
  string  TemplateId
);
[C++]
public: void MakePublic(
  CUserAuth*  Caller,
  String*  TemplateId
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvWriteEmailTemplate privilege to perform this action. See CUserAuth.
TemplateId
Specifies the ID of the template that is to be made public.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if an object is made private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
string strEmailTemplateId = "{586D80AA-3E9B-4936-ABCA-2C4EB37FBE82}";

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make the template public
   emailtemplate.MakePublic(userAuth, strEmailTemplateId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmailTemplate Class
  • MakePrivate


CRMEmailTemplate.MakeUnvailableToOrganization Method

The MakeUnvailableToOrganization method makes the specified e-mail template no longer available to the entire organization.

Syntax

[Visual Basic .NET]
Public Sub MakeUnvailableToOrganization(
  ByVal Caller As CUserAuth,
  ByVal TemplateId As String
)
[C#]
public void MakeUnvailableToOrganization(
  CUserAuth  Caller,
  string  TemplateId
);
[C++]
public: void MakeUnvailableToOrganization(
  CUserAuth*  Caller,
  String*  TemplateId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateOrgEmailTemplates privilege to perform this action. See CUserAuth.
TemplateId
Specifies the ID of the template that is to be made unavailable.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate  emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
string strEmailTemplateId = "{586D80AA-3E9B-4936-ABCA-2C4EB37FBE82}";

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make the template unvailable to the organization
   emailtemplate.MakeUnvailableToOrganization (userAuth, strEmailTemplateId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmailTemplate Class
  • MakeAvailableToOrganization


CRMEmailTemplate.Retrieve Method

The Retrieve method retrieves a personal e-mail template.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal TemplateId As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  TemplateId
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  TemplateId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadEmailTemplate privilege to perform this action. See CUserAuth.
TemplateId
Specifies the ID of the template that is to be retrieved.

Return Value

Returns a String type that specifies the XML data containing the template. The XML schema is described by template.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
string strEmailTemplateId = "{586D80AA-3E9B-4936-ABCA-2C4EB37FBE82}";

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the XML data for the template
   string strResultsXml = emailtemplate.Retrieve(userAuth, strEmailTemplateId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmailTemplate Class
  • RetrieveByPrincipal


CRMEmailTemplate.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves all personal e-mail templates that are owned by the specified security principal (user or team).

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal SecurityPrincipal As CSecurityPrincipal,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  SecurityPrincipal,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  SecurityPrincipal,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadEmailTemplate privilege to perform this action. See CUserAuth.
SecurityPrincipal
Specifies the security principal for which templates are to be retrieved. See CSecurityPrincipal.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in template.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of templates associated with the specified security principal. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<templates> + template1..N + </templates>

where the XML schema for each template is described by template.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>templateid</column>";
   strColumnSetXml += "<column>subject</column>";
   strColumnSetXml += "</columnset>";

   // Now retrieve the e-mail template XML data
   string strResultsXml = emailtemplate.RetrieveByPrincipal (userAuth, securityPrincipal, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmailTemplate Class
  • Retrieve


CRMEmailTemplate.RetrievePrincipalAccess Method

The RetrievePrincipalAccess method retrieves the access rights that a security principal has for an e-mail template.

Syntax

[Visual Basic .NET]
Public Function RetrievePrincipalAccess(
  ByVal Caller As CUserAuth,
  ByVal TemplateId As String,
  ByVal Principal As CSecurityPrincipal
) As UInt32
[C#]
public uint RetrievePrincipalAccess(
  CUserAuth  Caller,
  string  TemplateId,
  CSecurityPrincipal  Principal
);
[C++]
public: unsigned long RetrievePrincipalAccess(
  CUserAuth*  Caller,
  String*  TemplateId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadEmailTemplate privilege to perform this action. See CUserAuth.
TemplateId
Specifies the ID of the e-mail template.
Principal
Specifies the security principal for whom access rights are to be retrieved. See CSecurityPrincipal.

Return Value

Returns a UInt32 type that specifies the rights the security principal is assigned for the e-mail template. See ACCESSRIGHTS.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
string strEmailTemplateId = "{586D80AA-3E9B-4936-ABCA-2C4EB37FBE82}";
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Now retrieve principal access
   uint access = emailtemplate.RetrievePrincipalAccess(userAuth, strEmailTemplateId, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmailTemplate Class


CRMEmailTemplate.Send Method

The Send method sends a bulk mail e-mail message that was created from a template.

Syntax

[Visual Basic .NET]
Public Sub Send(
  ByVal Caller As CUserAuth,
  ByVal TemplateId As String,
  ByVal Sender As CObjectName,
  ByVal RecipientType As ObjectType,
  ByVal RecipientIds As String()
)
[C#]
public void Send(
  CUserAuth  Caller,
  string  TemplateId,
  CObjectName  Sender,
  ObjectType  RecipientType,
  string[]  RecipientIds
);
[C++]
public: void Send(
  CUserAuth*  Caller,
  String*  TemplateId,
  CObjectName*  Sender,
  ObjectType  RecipientType,
  String*  RecipientIds __gc[]
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadEmailTemplate, prvReadActivity, and prvWriteActivity privileges to perform this action. See CUserAuth.
TemplateId
Specifies the ID of the template that is to be sent.
Sender
Specifies the sender of the e-mail message. See CObjectName.
RecipientType
Specifies the object type of the recipient. See ObjectType.
RecipientIds
Specifies an array of recipient IDs.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate  emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
string strEmailTemplateId = "{586D80AA-3E9B-4936-ABCA-2C4EB37FBE82}";

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string [] acctIds = new string[1];
   Microsoft.Crm.Platform.Proxy.CObjectName obj = new Microsoft.Crm.Platform.Proxy.CObjectName();
   obj.Id = userAuth.UserId;
   obj.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otSystemUser;

   acctIds[0] = "{A2666B0-6978-4E07-8LA4-5695D30D2EBE}"; //Should be a valied account id

   // Now send the e-mail template
   emailtemplate.Send(userAuth, strEmailTemplateId, obj, Microsoft.Crm.Platform.Proxy.ObjectType.otAccount, acctIds);

   }
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMEmailTemplate Class


CRMEmailTemplate.Update Method

The Update method updates a personal e-mail template.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal TemplateId As String,
  ByVal TemplateXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  TemplateId,
  string  TemplateXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  TemplateId,
  String*  TemplateXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteEmailTemplate privilege to perform this action. See CUserAuth.
TemplateId
Specifies the ID of the template that is to be updated.
TemplateXml
Specifies an XML string describing the e-mail template. The XML schema is described by template.xsd.

Return Value

No return value.

Remarks

Create a value for the presentationxml field that is meaningful for your application.

Note These templates do not work with the Microsoft CRM application, which uses a proprietary e-mail template format.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate  emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
string strEmailTemplateId = "{586D80AA-3E9B-4936-ABCA-2C4EB37FBE82}";
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

      // Set up the updated XML string for the e-mail template
      string strXmlTemplate = "<template>";
      strXmlTemplate += "<subject>A New Template Subject</subject>";
      strXmlTemplate += "<templatetypecode>2</templatetypecode>";
      strXmlTemplate += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
      strXmlTemplate += userAuth.UserId + "</ownerid>";
      strXmlTemplate += "</template>";

      // Update the e-mail template
      emailtemplate.Update (userAuth, strEmailTemplateId, strXmlTemplate);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMEmailTemplate Class
  • UpdateAndRetrieve


CRMEmailTemplate.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a personal e-mail template and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal TemplateId As String,
  ByVal TemplateXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  TemplateId,
  string  TemplateXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  TemplateId,
  String*  TemplateXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteEmailTemplate and prvReadEmailTemplate privileges to perform this action. See CUserAuth.
TemplateId
Specifies the ID of the template.
TemplateXml
Specifies an XML string describing the e-mail template. The XML schema is described by template.xsd.

Return Value

Returns a String type that specifies the XML data containing the template. The XML schema is described by template.xsd.

Remarks

Create a value for the presentationxml field that is meaningful for your application.

Note These templates do not work with the Microsoft CRM application, which uses a proprietary e-mail template format.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMEmailTemplate proxy object
Microsoft.Crm.Platform.Proxy.CRMEmailTemplate  emailtemplate = new Microsoft.Crm.Platform.Proxy.CRMEmailTemplate();
emailtemplate.Credentials = System.Net.CredentialCache.DefaultCredentials;
emailtemplate.Url = strDir + "CRMEmailTemplate.srf";

string strErrorMsg;
string strEmailTemplateId = "{586D80AA-3E9B-4936-ABCA-2C4EB37FBE82}";

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the updated XML string for the e-mail template
   string strXmlTemplate = "<template>";
   strXmlTemplate += "<subject>A New Template Subject</subject>";
   strXmlTemplate += "<templatetypecode>2</templatetypecode>";
   strXmlTemplate += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strXmlTemplate += userAuth.UserId + "</ownerid>";
   strXmlTemplate += "</template>";

   // Update and then retrieve the e-mail template
   string strResultsXml = emailtemplate.UpdateAndRetrieve(userAuth, strEmailTemplateId, strXmlTemplate);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMEmailTemplate Class
  • Update


CRMFiscalCalendar Class

The CRMFiscalCalendar class contains methods that you can use to manage quotas for salespeople.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMFiscalCalendar
[Visual Basic .NET]
Public Class CRMFiscalCalendar
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMFiscalCalendar : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMFiscalCalendar: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMFiscalCalendar class exposes the following methods.

Method | Description
Create | Creates a fiscal calendar.
CreateAndRetrieve | Creates a fiscal calendar and then retrieves it.
Delete | Deletes a fiscal calendar.
Retrieve | Retrieves a fiscal calendar.
RetrieveByUser | Retrieves a fiscal calendar for the specified user.
RetrieveByUserAndYear | Retrieves a fiscal calendar for the specified user and year.
Update | Updates a fiscal calendar.
UpdateAndRetrieve | Updates a fiscal calendar and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMFiscalCalendar.Create Method

The Create method creates a fiscal calendar.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal CalendarType As Integer,
  ByVal EntityXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  int  CalendarType,
  string  EntityXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  long  CalendarType,
  String*  EntityXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteUser privilege to perform this action. See CUserAuth.
CalendarType
Specifies the calendar type. This is one of the following in the ObjectType class: otAnnualFiscalCalendar, otFixedMonthlyFiscalCalendar, otMonthlyFiscalCalendar, otQuarterlyFiscalCalendar, or otSemiAnnualFiscalCalendar.
EntityXML
Specifies an XML string containing the fiscal calendar information. Depending on the value of CalendarType, the XML schema is described by one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd.

Return Value

Returns a String type that specifies the ID of the newly created fiscal calendar.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMFiscalCalendar proxy object
Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar  fiscalcalendar  = new Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar();
fiscalcalendar.Credentials = System.Net.CredentialCache.DefaultCredentials;
fiscalcalendar.Url = strDir + "CRMFiscalcalendar.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the fiscal calendar
   string xml = "<semiannualfiscalcalendar>";
   xml += "<salespersonid>" + userAuth.UserId + "</salespersonid>";
   xml += "<effectiveon>2002:12:12</effectiveon>";
   xml += "<firsthalf>123.00</firsthalf>";
   xml += "</semiannualfiscalcalendar>";

   int type = Microsoft.Crm.Platform.Types.ObjectType.otSemiAnnualFiscalCalendar;

   string strFiscalCalendarId = fiscalcalendar.Create(userAuth, type, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMFiscalCalendar Class
  • Update


CRMFiscalCalendar.CreateAndRetrieve Method

The CreateAndRetrieve method creates a fiscal calendar and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal CalendarType As Integer,
  ByVal EntityXml As String,
  ByVal ColumnSet As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  int  CalendarType,
  string  EntityXml,
  string  ColumnSet
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  long  CalendarType,
  String*  EntityXml,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteUser and prvReadUser privileges to perform this action. See CUserAuth.
CalendarType
Specifies the calendar type. This is one of the following in the ObjectType class: otAnnualFiscalCalendar, otFixedMonthlyFiscalCalendar, otMonthlyFiscalCalendar, otQuarterlyFiscalCalendar, or otSemiAnnualFiscalCalendar.
EntityXml
Specifies an XML string containing the fiscal calendar information. Depending on the value of CalendarType, the XML schema is described by one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. Depending on the value of CalendarType, you can find the valid column names in one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested fiscal calendar information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. Depending on the value of CalendarType, the XML schema is described by one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMFiscalCalendar proxy object
Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar  fiscalcalendar  = new Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar();
fiscalcalendar.Credentials = System.Net.CredentialCache.DefaultCredentials;
fiscalcalendar.Url = strDir + "CRMFiscalcalendar.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the fiscal calendar
   string xml = "<semiannualfiscalcalendar>";
   xml += "<salespersonid>" + userAuth.UserId + "</salespersonid>";
   xml += "<effectiveon>2003:11:11</effectiveon>";
   xml += "<firsthalf>123.00</firsthalf>";
   xml += "</semiannualfiscalcalendar>";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>firsthalf</column>";
   strColumnSetXml += "<column>effectiveon</column>";
   strColumnSetXml += "<column>salespersonid</column>";
   strColumnSetXml += "</columnset>";

   int type = Microsoft.Crm.Platform.Types.ObjectType.otSemiAnnualFiscalCalendar;

   string strResultXml = fiscalcalendar.CreateAndRetrieve(userAuth, type, xml, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMFiscalCalendar Class
  • UpdateAndRetrieve


CRMFiscalCalendar.Delete Method

The Delete method deletes a fiscal calendar.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal CalendarType As Integer,
  ByVal EntityId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  int  CalendarType,
  string  EntityId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  long  CalendarType,
  String*  EntityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteUser privilege to perform this action. See CUserAuth.
CalendarType
Specifies the calendar type. This is one of the following in the ObjectType class: otAnnualFiscalCalendar, otFixedMonthlyFiscalCalendar, otMonthlyFiscalCalendar, otQuarterlyFiscalCalendar, or otSemiAnnualFiscalCalendar.
EntityId
Specifies the ID of the fiscal calendar that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMFiscalCalendar proxy object
Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar  fiscalcalendar  = new Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar();
fiscalcalendar.Credentials = System.Net.CredentialCache.DefaultCredentials;
fiscalcalendar.Url = strDir + "CRMFiscalcalendar.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   int type = Microsoft.Crm.Platform.Types.ObjectType.otSemiAnnualFiscalCalendar;
   string strFiscalCalendarId = "{6B4C1C0D-B62C-4BBF-A1EB-AAEE09ECE4C3}";

   // Delete the fiscal calendar
   fiscalcalendar.Delete(userAuth, type, strFiscalCalendarId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMFiscalCalendar Class


CRMFiscalCalendar.Retrieve Method

The Retrieve method retrieves a fiscal calendar.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal CalendarType As Integer,
  ByVal EntityId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  int  CalendarType,
  string  EntityId,
  string  ColumnSet
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  long  CalendarType,
  String*  EntityId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadUser privilege to perform this action. See CUserAuth.
CalendarType
Specifies the calendar type. This is one of the following in the ObjectType class: otAnnualFiscalCalendar, otFixedMonthlyFiscalCalendar, otMonthlyFiscalCalendar, otQuarterlyFiscalCalendar, or otSemiAnnualFiscalCalendar.
EntityId
Specifies the ID of the fiscal calendar that is to be retrieved.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. Depending on the value of CalendarType, you can find the valid column names in one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested fiscal calendar information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. Depending on the value of CalendarType, the XML schema is described by one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMFiscalCalendar proxy object
Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar  fiscalcalendar  = new Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar();
fiscalcalendar.Credentials = System.Net.CredentialCache.DefaultCredentials;
fiscalcalendar.Url = strDir + "CRMFiscalcalendar.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   int type = Microsoft.Crm.Platform.Types.ObjectType.otSemiAnnualFiscalCalendar;
   string strFiscalCalendarId = "{6B4C1C0D-B62C-4BBF-A1EB-AAEE09ECE4C3}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>firsthalf</column>";
   strColumnSetXml += "<column>effectiveon</column>";
   strColumnSetXml += "<column>salespersonid</column>";
   strColumnSetXml += "</columnset>";

   string strResultsXml = fiscalcalendar.Retrieve(userAuth, type, strFiscalCalendarId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMFiscalCalendar Class
  • RetrieveByUserAndYear


CRMFiscalCalendar.RetrieveByUser Method

The RetrieveByUser method retrieves a fiscal calendar that is associated with a specified user.

Syntax

[Visual Basic .NET]
Public Function RetrieveByUser(
  ByVal Caller As CUserAuth,
  ByVal CalendarType As Integer,
  ByVal UserId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveByUser(
  CUserAuth  Caller,
  int  CalendarType,
  string  UserId,
  string  ColumnSet
);
[C++]
public: String* RetrieveByUser(
  CUserAuth*  Caller,
  long  CalendarType,
  String*  UserId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteUser privilege to perform this action. See CUserAuth.
CalendarType
Specifies the calendar type. This is one of the following in the ObjectType class: otAnnualFiscalCalendar, otFixedMonthlyFiscalCalendar, otMonthlyFiscalCalendar, otQuarterlyFiscalCalendar, or otSemiAnnualFiscalCalendar.
UserId
Specifies the ID of the user.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. Depending on the value of CalendarType, you can find the valid column names in one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested fiscal calendar information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. Depending on the value of CalendarType, the XML schema is described by one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd.

For example, for a CalendarType of otAnnualFiscalCalendar, the returned XML string is in the following format:

<annualfiscalcalendars> + annualfiscalcalendar1..N + </annualfiscalcalendars>

where annualfiscalcalendar1..N is replaced by the appropriate data based on the annual fiscal calendar schema.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMFiscalCalendar proxy object
Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar  fiscalcalendar  = new Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar();
fiscalcalendar.Credentials = System.Net.CredentialCache.DefaultCredentials;
fiscalcalendar.Url = strDir + "CRMFiscalcalendar.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   int type = Microsoft.Crm.Platform.Types.ObjectType.otSemiAnnualFiscalCalendar;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>firsthalf</column>";
   strColumnSetXml += "<column>effectiveon</column>";
   strColumnSetXml += "<column>salespersonid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve by user
   string strResultsXml = fiscalcalendar.RetrieveByUser(userAuth, type, userAuth.UserId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMFiscalCalendar Class
  • Retrieve
  • RetrieveByUserAndYear


CRMFiscalCalendar.RetrieveByUserAndYear Method

The RetrieveByUserAndYear method retrieves any fiscal calendars that are associated with a specified user for specified year.

Syntax

[Visual Basic .NET]
Public Function RetrieveByUserAndYear(
  ByVal Caller As CUserAuth,
  ByVal CalendarType As Integer,
  ByVal UserId As String,
  ByVal EffectiveOn As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveByUserAndYear(
  CUserAuth  Caller,
  int  CalendarType,
  string  UserId,
  string  EffectiveOn,
  string  ColumnSet
);
[C++]
public: String* RetrieveByUserAndYear(
  CUserAuth*  Caller,
  long  CalendarType,
  String*  UserId,
  String*  EffectiveOn,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadUser privilege to perform this action. See CUserAuth.
CalendarType
Specifies the calendar type. This is one of the following in the ObjectType class: otAnnualFiscalCalendar, otFixedMonthlyFiscalCalendar, otMonthlyFiscalCalendar, otQuarterlyFiscalCalendar, or otSemiAnnualFiscalCalendar.
UserId
Specifies the identity of the user whose calendar is to be retrieved.
EffectiveOn
Specifies the date on which the calendar becomes effective.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. Depending on the value of CalendarType, you can find the valid column names in one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested fiscal calendar information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. Depending on the value of CalendarType, the XML schema is described by one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd.

For example, for a CalendarType of otAnnualFiscalCalendar, the returned XML string is in the following format:

<annualfiscalcalendars> + annualfiscalcalendar1..N + </annualfiscalcalendars>

where annualfiscalcalendar1..N is replaced by the appropriate data based on the annual fiscal calendar schema.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMFiscalCalendar proxy object
Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar  fiscalcalendar  = new Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar();
fiscalcalendar.Credentials = System.Net.CredentialCache.DefaultCredentials;
fiscalcalendar.Url = strDir + "CRMFiscalcalendar.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   int type = Microsoft.Crm.Platform.Types.ObjectType.otSemiAnnualFiscalCalendar;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>firsthalf</column>";
   strColumnSetXml += "<column>effectiveon</column>";
   strColumnSetXml += "<column>salespersonid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve by user and by year
   string strResultsXml = fiscalcalendar.RetrieveByUserAndYear(userAuth, type, userAuth.UserId, "2002:12:12", strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMFiscalCalendar Class
  • Retrieve


CRMFiscalCalendar.Update Method

The Update method updates a fiscal calendar.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal CalendarType As Integer,
  ByVal EntityId As String,
  ByVal EntityXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  int  CalendarType,
  string  EntityId,
  string  EntityXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  long  CalendarType,
  String*  EntityId,
  String*  EntityXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteUser privilege to perform this action. See CUserAuth.
CalendarType
Specifies the calendar type. This is one of the following in the ObjectType class: otAnnualFiscalCalendar, otFixedMonthlyFiscalCalendar, otMonthlyFiscalCalendar, otQuarterlyFiscalCalendar, or otSemiAnnualFiscalCalendar.
EntityId
Specifies the ID of the calendar that is to be updated.
EntityXml
Specifies an XML string containing the fiscal calendar information. Depending on the value of CalendarType, the XML schema is described by one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMFiscalCalendar proxy object
Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar  fiscalcalendar  = new Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar();
fiscalcalendar.Credentials = System.Net.CredentialCache.DefaultCredentials;
fiscalcalendar.Url = strDir + "CRMFiscalcalendar.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strFiscalCalendarId = "{6B4C1C0D-B62C-4BBF-A1EB-AAEE09ECE4C3}";

   string xml = "<semiannualfiscalcalendar>";
   xml += "<firsthalf>124.00</firsthalf>";
   xml += "</semiannualfiscalcalendar>";

   int type = Microsoft.Crm.Platform.Types.ObjectType.otSemiAnnualFiscalCalendar;

   // Update the fiscal calendar
   fiscalcalendar.Update(userAuth, type, strFiscalCalendarId, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMFiscalCalendar Class
  • UpdateAndRetrieve


CRMFiscalCalendar.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a fiscal calendar and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal CalendarType As Integer,
  ByVal EntityId As String,
  ByVal EntityXml As String,
  ByVal ColumnSet As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  int  CalendarType,
  string  EntityId,
  string  EntityXml,
  string  ColumnSet
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  long  CalendarType,
  String*  EntityId,
  String*  EntityXml,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteUser and prvReadUser privileges to perform this action. See CUserAuth.
CalendarType
Specifies the calendar type. This is one of the following in the ObjectType class: otAnnualFiscalCalendar, otFixedMonthlyFiscalCalendar, otMonthlyFiscalCalendar, otQuarterlyFiscalCalendar, or otSemiAnnualFiscalCalendar.
EntityId
Specifies the ID of the fiscal calendar that is to be updated.
EntityXml
Specifies an XML string containing the fiscal calendar information. Depending on the value of CalendarType, the XML schema is described by one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd.
ColumnSet
Specifies an XML string describing the set of columns that are to be retrieved. Passing "" or null returns all columns. Depending on the value of CalendarType, you can find the valid column names in one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested fiscal calendar information. Depending on the value of CalendarType, the fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by one of the following: annualfiscalcalendar.xsd, fixedmonthlyfiscalcalendar.xsd, monthlyfiscalcalendar.xsd, quarterlyfiscalcalendar.xsd, or semiannualfiscalcalendar.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMFiscalCalendar proxy object
Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar  fiscalcalendar  = new Microsoft.Crm.Platform.Proxy.CRMFiscalCalendar();
fiscalcalendar.Credentials = System.Net.CredentialCache.DefaultCredentials;
fiscalcalendar.Url = strDir + "CRMFiscalcalendar.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strFiscalCalendarId = "{6B4C1C0D-B62C-4BBF-A1EB-AAEE09ECE4C3}";

   string xml = "<semiannualfiscalcalendar>";
   xml += "<firsthalf>124.00</firsthalf>";
   xml += "</semiannualfiscalcalendar>";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>firsthalf</column>";
   strColumnSetXml += "<column>effectiveon</column>";
   strColumnSetXml += "<column>salespersonid</column>";
   strColumnSetXml += "</columnset>";

   int type = Microsoft.Crm.Platform.Types.ObjectType.otSemiAnnualFiscalCalendar;

   // Update and then retrieve the fiscal calendar
   string strResultsXml = fiscalcalendar.UpdateAndRetrieve(userAuth, type, strFiscalCalendarId, xml, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMFiscalCalendar Class
  • Update


CRMIncident Class

The CRMIncident class contains methods that you can use to manage incidents.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMIncident
[Visual Basic .NET]
Public Class CRMIncident
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMIncident : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMIncident: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMIncident class exposes the following methods.

Method | Description
CalculateTotalTime | Calculates the total time that is spent on the incident.
Cancel | Sets the state of an incident to Canceled.
Close | Sets the state of the incident to Closed.
Create | Creates a new incident.
CreateAndRetrieve | Creates a new incident and then retrieves it.
Delete | Deletes an incident
GrantAccess | Grants the specified security principal access to the incident.
Handle | Handles an incident. This moves the incident to the user WIP Bin queue from the queue specified by SourceQueueId.
ModifyAccess | Replaces the access rights on the incident for the specified security principal.
Open | Sets the state of the incident to Open.
Retrieve | Retrieves an existing incident.
RetrieveByObject | Retrieves all incidents that are associated with an object (account or contact).
RetrieveByPrincipal | Retrieves all incidents that are owned by the specified security principal.
RetrievePrincipalAccess | Retrieves the access the specified security principal has for the specified incident.
RetrieveSharedPrincipals | Retrieves the security principals who share the specified incident
RetrieveSharedPrincipalsAndAccess | Retrieves all of the security principals (users or teams) that have access to the specified incident and their access rights for the incident.
RevokeAccess | Revokes the access of a security principal to the specified incident.
Route | Routes an incident. This moves it to a user private queue, to a public queue, or to auto routing from the queue specified by SourceQueueId.
UnHandle | Not supported in this version.
Update | Updates an existing incident.
UpdateAndRetrieve | Updates an existing incident and then retrieves it.
ValidForClose | Checks whether it is valid to close this incident.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMIncident.CalculateTotalTime Method

The CalculateTotalTime method calculates the total time that is spent on the incident.

Syntax

[Visual Basic .NET]
Public Function CalculateTotalTime(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String
) As UInt32
[C#]
public uint CalculateTotalTime(
  CUserAuth  Caller,
  string  IncidentId
);
[C++]
public: unsigned long CalculateTotalTime(
  CUserAuth*  Caller,
  String*  IncidentId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident.

Return Value

Returns a UInt32 type that specifies the total time in minutes that has been spent on the incident.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Calculate the total time that has been spent on this incident
   uint totaltime = incident.CalculateTotalTime(userAuth, strIncidentId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class


CRMIncident.Cancel Method

The Cancel method sets the state of an incident to Canceled.

Syntax

[Visual Basic .NET]
Public Sub Cancel(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByVal Status As Integer
)
[C#]
public void Cancel(
  CUserAuth  Caller,
  string  IncidentId,
  int  Status
);
[C++]
public: void Cancel(
  CUserAuth*  Caller,
  String*  IncidentId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident that is to be canceled.
Status
Specifies the new status for the incident. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Cancel the incident
   incident.Cancel(userAuth, strIncidentId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class


CRMIncident.Close Method

The Close method sets the state of the incident to Closed.

Note The Microsoft CRM application uses "Resolved" in the user interface for this state.

Syntax

[Visual Basic .NET]
Public Sub Close(
  ByVal Caller As CUserAuth,
  ByVal ActivityXml As String,
  ByVal PartiesXml As String,
  ByVal Status As Integer
)
[C#]
public void Close(
  CUserAuth  Caller,
  string  ActivityXml,
  string  PartiesXml,
  int  Status
);
[C++]
public: void Close(
  CUserAuth*  Caller,
  String*  ActivityXml,
  String*  PartiesXml,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteIncident privilege to perform this action. See CUserAuth.
ActivityXml
Specifies an XML string representing an activity. . The XML schema is described by incidentresolutionactivity.xsd.
PartiesXml
Specifies an XML string representing the activity party information. . The XML schema is described by activityparty.xsd.
Status
Specifies the new status for the incident. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the closing incident activity
   string strXml = "<activity><activitytypecode>140</activitytypecode>";
   strXml += "<objecttypecode>112</objecttypecode>";
   strXml += "<objectid>" + strIncidentId + "</objectid>";
   strXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strXml += userAuth.UserId + "</ownerid></activity>";

   // Close the incident
   incident.Close(userAuth, strXml, "", -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class


CRMIncident.Create Method

The Create method creates a new incident.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal IncidentXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  IncidentXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  IncidentXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateIncident privilege to perform this action. See CUserAuth.
IncidentXML
Specifies an XML string containing the incident information. The XML schema is described by incident.xsd.

Return Value

Returns a String type that specifies the ID of the new incident.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
string strIncidentXml;
string strIncidentId;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the new incident
   strIncidentXml = "<incident>";
   strIncidentXml += "<title>Incident 1</title>";
   strIncidentXml += "<accountid>" + strAccountId +"</accountid>";
   strIncidentXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strIncidentXml += userAuth.UserId + "</ownerid>";
   strIncidentXml += "</incident>";

   // Create an incident
   strIncidentId = incident.Create(userAuth, strIncidentXml
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMIncident Class
  • Update


CRMIncident.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new incident and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal IncidentXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  IncidentXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  IncidentXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateIncident and prvReadIncident privileges to perform this action. See CUserAuth.
IncidentXML
Specifies an XML string containing the incident information. The XML schema is described by incident.xsd.

Return Value

Returns a String type that specifies the XML data containing the new incident. The XML schema is described by incident.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the incident
   string strIncidentXml = "<incident>";
   strIncidentXml += "<title>Incident 1</title>";
   strIncidentXml += "<accountid>" + strAccountId +"</accountid>";
   strIncidentXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strIncidentXml += userAuth.UserId + "</ownerid>";
   strIncidentXml += "</incident>";

   // Create and then retrieve the incident
   string strResultXml = incident.CreateAndRetrieve(userAuth, strIncidentXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMIncident Class
  • UpdateAndRetrieve


CRMIncident.Delete Method

The Delete method deletes an incident.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  IncidentId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  IncidentId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the incident
   incident.Delete(userAuth, strIncidentId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class


CRMIncident.GrantAccess Method

The GrantAccess method grants a security principal access to the specified incident (case). This method also applies to all child objects of the incident (case). For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the incident (case). In this case, only the lack of privileges for a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub GrantAccess(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void GrantAccess(
  CUserAuth  Caller,
  string  IncidentId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void GrantAccess(
  CUserAuth*  Caller,
  String*  IncidentId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident that is to be deleted.
Rights
Specifies the rights that are to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or user that is to be granted access. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";

string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Grant access for the security principal
   incident.GrantAccess(userAuth, strIncidentId, rights, securityPrincipal);

   // Revoke access for the security principal
   incident.RevokeAccess(userAuth, strIncidentId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class


CRMIncident.Handle Method

The Handle method handles an incident. This moves it to the user WIP Bin queue from the queue specified by SourceQueueId.

Syntax

[Visual Basic .NET]
Public Sub Handle(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByVal SourceQueueId As String
)
[C#]
public void Handle(
  CUserAuth  Caller,
  string  IncidentId,
  string  SourceQueueId
);
[C++]
public: void Handle(
  CUserAuth*  Caller,
  String*  IncidentId,
  String*  SourceQueueId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident that is to be moved to the WIP Bin queue.
SourceQueueId
Specifies the ID of the source queue.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strQueueId = "{D985D31D-3C83-4FAD-BDE4-404565615CBA}";
   string strIncidentId = "{A9A6EBFD-0A6E-49A2-9245-27D9BC810704}";

   incident.Handle(userAuth, strIncidentId, strQueueId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class


CRMIncident.ModifyAccess Method

The ModifyAccess method replaces the access rights on the incident (case) for the specified security principal. This method also applies to all child objects of the incident (case). For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the incident (case). In this case, only the lack of privileges to a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub ModifyAccess(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void ModifyAccess(
  CUserAuth  Caller,
  string  IncidentId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void ModifyAccess(
  CUserAuth*  Caller,
  String*  IncidentId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvShareIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident.
Rights
Specifies the set of rights that are to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or user that is to be granted access. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";

string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Grant access for the security principal
   incident.GrantAccess(userAuth, strIncidentId, rights, securityPrincipal);

uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_WRITE;

   // Revoke access for the security principal
   incident.ModifyAccess(userAuth, strIncidentId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class


CRMIncident.Open Method

The Open method sets state of the incident to Open.

Syntax

[Visual Basic .NET]
Public Sub Open(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByVal Status As Integer
)
[C#]
public void Open(
  CUserAuth  Caller,
  string  IncidentId,
  int  Status
);
[C++]
public: void Open(
  CUserAuth*  Caller,
  String*  IncidentId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvwriteIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident.
Status
Specifies the new status of the incident. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Open the incident
   incident.Open(userAuth, strIncidentId, -1);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Close
  • CRMIncident Class


CRMIncident.Retrieve Method

The Retrieve method retrieves an existing incident.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  IncidentId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  IncidentId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in incident.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the incident information. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by incident.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>incidentid</column>";
   // Put the incidents in order by contract
   strColumnSetXml += "<ascend>contractid</ascend>";
   // Filter the incidents
   strColumnSetXml += "<filter column='title' operator='like' value='incident1,incident1)*' />";
   strColumnSetXml += "</columnset>";

   // Now retrieve the incidents
   string strResultsXml = incident.Retrieve(userAuth, strIncidentId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class
  • RetrieveByObject
  • RetrieveByPrincipal
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipals
  • RetrieveSharedPrincipalsAndAccess


CRMIncident.RetrieveByObject Method

The RetrieveByObject method retrieves all incidents that are associated with an object (account or contact).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadIncident privilege to perform this action. See CUserAuth.
Object
Specifies the object (account or contact) for which you want to retrieve associated incidents. See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in incident.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of incidents requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<incidents> + incident1..N + </incidents>

where the XML schema for each incident is described by incident.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>incidentid</column>";
   strColumnSetXml += "<column>productid</column>";
   strColumnSetXml += "</columnset>";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Retrieve the incidents
   string strResultsXml = incident.RetrieveByObject(userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class
  • Retrieve


CRMIncident.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves all of the incidents that are owned by the specified security principal.

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal Principal As CSecurityPrincipal,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  Principal,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  Principal,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadIncident privilege to perform this action. See CUserAuth.
Principal
Specifies the security principal whose incidents you want to retrieve. See CSecurityPrincipal.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in incident.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of incidents requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<incidents> + incident1..N + </incidents>

where the XML schema for each incident is described by incident.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>incidentid</column>";
   strColumnSetXml += "</columnset>";

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve all of the incidents for the specified security principal
   string strIncidentsXml = incident.RetrieveByPrincipal(userAuth, securityPrincipal, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class
  • Retrieve


CRMIncident.RetrievePrincipalAccess Method

The RetrievePrincipalAccess method retrieves the access that a security principal has for the specified incident.

Syntax

[Visual Basic .NET]
Public Function RetrievePrincipalAccess(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByVal Principal As CSecurityPrincipal
) As UInt32
[C#]
public uint RetrievePrincipalAccess(
  CUserAuth  Caller,
  string  IncidentId,
  CSecurityPrincipal  Principal
);
[C++]
public: unsigned long RetrievePrincipalAccess(
  CUserAuth*  Caller,
  String*  IncidentId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident.
Principal
Specifies the security principal. See CSecurityPrincipal.

Return Value

Returns a UInt32 type that specifies the access rights the security principal has for the incident.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";

string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve the access for the security principal
   uint access = incident.RetrievePrincipalAccess(userAuth, strIncidentId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class
  • Retrieve
  • RetrieveSharedPrincipals
  • RetrieveSharedPrincipalsAndAccess


CRMIncident.RetrieveSharedPrincipals Method

The RetrieveSharedPrincipals method returns the list of security principals who share the specified incident.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipals(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByVal Rights As UInt32
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipals(
  CUserAuth  Caller,
  string  IncidentId,
  uint  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipals(
  CUserAuth*  Caller,
  String*  IncidentId,
  unsigned long  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident.
Rights
Specifies the access rights for the incident. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of security principals requested. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;

   // Retrieve the shared principals for the incident
   securityPrincipals = incident.RetrieveSharedPrincipals (userAuth, strIncidentId, Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class
  • Retrieve
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipalsAndAccess


CRMIncident.RetrieveSharedPrincipalsAndAccess Method

The RetrieveSharedPrincipalsAndAccess method retrieves all of the security principals (users or teams) that have access to the specified incident and their access rights to the incident.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipalsAndAccess(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByRef Rights As UInt32()
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipalsAndAccess(
  CUserAuth  Caller,
  string  IncidentId,
  out uint[]  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipalsAndAccess(
  CUserAuth*  Caller,
  String*  IncidentId,
  unsigned long*  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident.
Rights
[out] Specifies the array of rights the security principals have for the incident. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of security principals requested. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
uint[] rights;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the shared principals and their access rights
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals = incident.RetrieveSharedPrincipalsAndAccess(userAuth, strIncidentId, out rights);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class
  • Retrieve
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipals


CRMIncident.RevokeAccess Method

The RevokeAccess method revokes access rights to the incident (case) for the specified security principal. This method also applies to all child objects of the incident (case). For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the incident (case). In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

Syntax

[Visual Basic .NET]
Public Sub RevokeAccess(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByVal Revokee As CSecurityPrincipal
)
[C#]
public void RevokeAccess(
  CUserAuth  Caller,
  string  IncidentId,
  CSecurityPrincipal  Revokee
);
[C++]
public: void RevokeAccess(
  CUserAuth*  Caller,
  String*  IncidentId,
  CSecurityPrincipal*  Revokee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident.
Revokee
Specifies the team or user whose access is to be revoked. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";

string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Grant access for the security principal
   incident.GrantAccess(userAuth, strIncidentId, rights, securityPrincipal);

   // Revoke access for the security principal
   incident.RevokeAccess(userAuth, strIncidentId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class


CRMIncident.Route Method

The Route method routes an incident. This moves it to the user private queue, to the public queue, or to auto routing from the queue specified by SourceQueueId.

Syntax

[Visual Basic .NET]
Public Sub Route(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByVal SourceQueueId As String,
  ByVal RouteTypeCode As ROUTE_TYPE_CODE,
  ByVal EndPointId As String
)
[C#]
public void Route(
  CUserAuth  Caller,
  string  IncidentId,
  string  SourceQueueId,
  ROUTE_TYPE_CODE  RouteTypeCode,
  string  EndPointId
);
[C++]
public: void Route(
  CUserAuth*  Caller,
  String*  IncidentId,
  String*  SourceQueueId,
  ROUTE_TYPE_CODE  RouteTypeCode,
  String*  EndPointId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident.
SourceQueueId
Specifies the ID of the source queue.
ROUTE_TYPE_CODE
Specifies the route type. See ROUTE_TYPE_CODE. See Remarks.
EndPointId
Specifies the ID of the end point. See Remarks.

Return Value

No return value.

Remarks

If the ROUTE_TYPE_CODE is RTC_QUEUE, EndPointID must be the ID of a queue.

If the ROUTE_TYPE_CODE is RTC_USER, EndPointID must be the ID of a user.

If the ROUTE_TYPE_CODE is RTC_AUTO, EndPointID is ignored.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strQueueId = "{D985D31D-3C83-4FAD-BDE4-404565615CBA}";
   string strIncidentId = "{A9A6EBFD-0A6E-49A2-9245-27D9BC810704}";

   // Route the incident
   incident.Route(userAuth, strIncidentId, strQueueId, Microsoft.Crm.Platform.Proxy.ROUTE_TYPE_CODE.RTC_AUTO, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class


CRMIncident.Update Method

The Update method updates an existing incident.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByVal IncidentXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  IncidentId,
  string  IncidentXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  IncidentId,
  String*  IncidentXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident that is to be updated.
IncidentXML
Specifies an XML string containing the incident information. The XML schema is described by incident.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strIncidentId="{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the incident
   string strIncidentXml = "<incident><title>New Title</title></incident>";

   // Update the incident
   incident.Update(userAuth, strIncidentId, strIncidentXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMIncident Class
  • UpdateAndRetrieve


CRMIncident.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an existing incident and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String,
  ByVal IncidentXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  IncidentId,
  string  IncidentXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  IncidentId,
  String*  IncidentXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteIncident and prvReadIncident privileges to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident that is to be updated.
IncidentXML
Specifies an XML string containing the incident information. The XML schema is described by incident.xsd.

Return Value

Returns a String type that specifies the XML data containing the incident information. The XML schema is described by incident.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the incident
   string strIncidentXml = "<incident><title>New Title</title></incident>";

   // Update the incident
   string strResultXml = incident.UpdateAndRetrieve(userAuth, strIncidentId, strIncidentXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMIncident Class
  • Update


CRMIncident.ValidForClose Method

The ValidForClose method checks whether it is valid to close the specified incident.

Syntax

[Visual Basic .NET]
Public Function ValidForClose(
  ByVal Caller As CUserAuth,
  ByVal IncidentId As String
) As Integer
[C#]
public int ValidForClose(
  CUserAuth  Caller,
  string  IncidentId
);
[C++]
public: long ValidForClose(
  CUserAuth*  Caller,
  String*  IncidentId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadIncident privilege to perform this action. See CUserAuth.
IncidentId
Specifies the ID of the incident.

Return Value

Returns an Int32 type that specifies whether it is valid to close this incident.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMIncident proxy object
Microsoft.Crm.Platform.Proxy.CRMIncident  incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
incident.Url = strDir + "CRMIncident.srf";
string strErrorMsg;
string strIncidentId = "{A7BBE89E-99A1-408A-9BA7-BE7013F2049B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Check whether it is valid to close the incident
   int valid = incident.ValidForClose(userAuth, strIncidentId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMIncident Class


CRMInvoice Class

The CRMInvoice class contains methods that you can use to manage invoices.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMInvoice
[Visual Basic .NET]
Public Class CRMInvoice
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMInvoice : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMInvoice: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMInvoice class exposes the following methods.

Method | Description
Assign | Assigns an invoice.
AssociateContact | Establishes an association between a contact and an invoice.
Close | Sets the state of an invoice to Closed.
Create | Creates an invoice.
CreateAndRetrieve | Creates an invoice and then retrieves it.
Delete | Deletes an invoice.
DisassociateContact | Eliminates the association between a contact and an invoice.
GenerateFromOpportunity | Generates an invoice from an opportunity.
GetProductsFromOpportunity | Retrieves the products from an opportunity and copies them to the specified invoice.
GrantAccess | Grants access to an invoice.
ModifyAccess | Replaces the access rights to the invoice for the specified security principal.
Retrieve | Retrieves an invoice.
RetrieveByObject | Retrieves all invoices that are associated with an object (account, contact, or opportunity).
RetrieveByPrincipal | Retrieves all invoices that are owned by a security principal.
RetrieveContacts | Retrieves all contacts that are associated with an invoice.
RetrievePrincipalAccess | Retrieves the access that is assigned to a specific security principal for a specific invoice.
RetrieveSharedPrincipalsAndAccess | Retrieves all of the security principals (users or teams) that have access to an invoice and their access rights to that invoice.
RevokeAccess | Revokes access to an invoice.
Update | Updates an invoice.
UpdateAndRetrieve | Updates an invoice and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMInvoice.Assign Method

The Assign method assigns the invoice to a security principal (user or team). (See Remarks.) This method also applies to the parent object and associated objects that have the same owner as the parent object. Therefore when you assign the parent object to a new owner, only the associated objects that have the same owner as the parent object are assigned. In addition, when an object is assigned to a new owner, it is shared with the previous owner with full rights. Either the new owner or the previous owner can remove the relationship or lower the level of privileges the previous owner had on the object.

Syntax

[Visual Basic .NET]
Public Sub Assign(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal Assignee As CSecurityPrincipal
)
[C#]
public void Assign(
  CUserAuth  Caller,
  string  InvoiceId,
  CSecurityPrincipal  Assignee
);
[C++]
public: void Assign(
  CUserAuth*  Caller,
  String*  InvoiceId,
  CSecurityPrincipal*  Assignee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignInvoice privilege to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice.
Assignee
Specifies the new owner (user or team) of the invoice. See CSecurityPrincipal.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not support business-object assignment to teams. Therefore, any solutions built by using this method are not supported by the Microsoft CRM application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the invoice to another security principal
   invoice.Assign(userAuth, strInvoiceId, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class


CRMInvoice.AssociateContact Method

The AssociateContact method establishes an association between a contact and an invoice.

Syntax

[Visual Basic .NET]
Public Sub AssociateContact(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal ContactId As String
)
[C#]
public void AssociateContact(
  CUserAuth  Caller,
  string  InvoiceId,
  string  ContactId
);
[C++]
public: void AssociateContact(
  CUserAuth*  Caller,
  String*  InvoiceId,
  String*  ContactId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendToInvoice and prvAppendContact privileges to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice.
ContactId
Specifies the ID of the contact that is to be associated with the invoice.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Associate the invoice with the contact
   invoice.AssociateContact(userAuth, strInvoiceId, strContactId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class


CRMInvoice.Close Method

The Close method sets the state of an invoice to Closed.

Syntax

[Visual Basic .NET]
Public Sub Close(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal Status As Integer
)
[C#]
public void Close(
  CUserAuth  Caller,
  string  InvoiceId,
  int  Status
);
[C++]
public: void Close(
  CUserAuth*  Caller,
  String*  InvoiceId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteInvoice privilege to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice that is to be closed.
Status
Specifies the status of the invoice. You can use this parameter to specify application status.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Close the invoice
   invoice.Close(userAuth, strInvoiceId, Microsoft.Crm.Platform.Types.INVOICE_STATE.INS_ACTIVE);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class


CRMInvoice.Create Method

The Create method creates an invoice.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal InvoiceXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  InvoiceXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  InvoiceXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateInvoice privilege to perform this action. See CUserAuth.
InvoiceXml
Specifies the XML string containing the invoice information. The XML schema is described by invoice.xsd.

Return Value

Returns a String type that specifies the ID of the new invoice.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the invoice
   string strInvoiceXml = "<invoice>";
   strInvoiceXml += "<name>invoice 1</name>";
   strInvoiceXml += "<customerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() +"\">";
   strInvoiceXml += strAccountId + "</customerid>";
   strInvoiceXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strInvoiceXml += userAuth.UserId + "</ownerid>";
   strInvoiceXml += "</invoice>";

   // Create the invoice
   string strInvoiceId = invoice.Create(userAuth, strInvoiceXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMInvoice Class
  • Update


CRMInvoice.CreateAndRetrieve Method

The CreateAndRetrieve method creates an invoice and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InInvoiceXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InInvoiceXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InInvoiceXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateInvoice and prvReadInvoice privileges to perform this action. See CUserAuth.
InInvoiceXml
Specifies the XML string containing the invoice information. The XML schema is described by invoice.xsd.

Return Value

Returns a String type that specifies the XML data containing the complete invoice information. The XML schema is described by invoice.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the invoice
   string strInvoiceXml = "<invoice>";
   strInvoiceXml += "<name>invoice 1</name>";
   strInvoiceXml += "<customerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() +"\">";
   strInvoiceXml += strAccountId + "</customerid>";
   strInvoiceXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strInvoiceXml += userAuth.UserId + "</ownerid>";
   strInvoiceXml += "</invoice>";

   // Create and then retrieve the invoice
   string strInvoiceXML = invoice.CreateAndRetrieve(userAuth, strInvoiceXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMInvoice Class
  • UpdateAndRetrieve


CRMInvoice.Delete Method

The Delete method deletes an invoice.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  InvoiceId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  InvoiceId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteInvoice privilege to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the invoice
   invoice.Delete(userAuth, strInvoiceId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class


CRMInvoice.DisassociateContact Method

The DisassociateContact method eliminates the association between a contact and an invoice.

Syntax

[Visual Basic .NET]
Public Sub DisassociateContact(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal ContactId As String
)
[C#]
public void DisassociateContact(
  CUserAuth  Caller,
  string  InvoiceId,
  string  ContactId
);
[C++]
public: void DisassociateContact(
  CUserAuth*  Caller,
  String*  InvoiceId,
  String*  ContactId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendToInvoice and prvAppendContact privileges to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice.
ContactId
Specifies the ID of the contact that is to be disassociated from the invoice.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";
string strContactId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Disassociate the invoice from the contact
   invoice.DisassociateContact(userAuth, strInvoiceId, strContactId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class


CRMInvoice.GenerateFromOpportunity Method

The GenerateFromOpportunity method generates an invoice from an opportunity.

Syntax

[Visual Basic .NET]
Public Function GenerateFromOpportunity(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string GenerateFromOpportunity(
  CUserAuth  Caller,
  string  OpportunityId,
  string  ColumnSetXml
);
[C++]
public: String* GenerateFromOpportunity(
  CUserAuth*  Caller,
  String*  OpportunityId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateInvoice and prvReadOpportunity privileges to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity that is to be used as the basis for the new invoice.
ColumnSetXml
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in invoice.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the complete invoice information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by invoice.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strOpportunityId = "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>invoicenumber</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Generate an invoice from the opportunity
   string strInvoiceXml = invoice.GenerateFromOpportunity(userAuth, strOpportunityId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class


CRMInvoice.GetProductsFromOpportunity Method

The GetProductsFromOpportunity method retrieves the products from an opportunity and copies them to the specified invoice.

Syntax

[Visual Basic .NET]
Public Sub GetProductsFromOpportunity(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal InvoiceId As String
)
[C#]
public void GetProductsFromOpportunity(
  CUserAuth  Caller,
  string  OpportunityId,
  string  InvoiceId
);
[C++]
public: void GetProductsFromOpportunity(
  CUserAuth*  Caller,
  String*  OpportunityId,
  String*  InvoiceId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteInvoice and prvReadOpportunity privileges to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
InvoiceId
Specifies the ID of the invoice.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual dDirectory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strOpportunityId = "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the products from the opportunity
   invoice.GetProductsFromOpportunity(userAuth, strOpportunityId, strInvoiceId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class


CRMInvoice.GrantAccess Method

The GrantAccess method grants a security principal access to the specified invoice. This method also applies to all child objects of the invoice. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the invoice. In this case, only the lack of privileges for a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub GrantAccess(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal Rights As UInt32,
  ByVal Principal As CSecurityPrincipal
)
[C#]
public void GrantAccess(
  CUserAuth  Caller,
  string  InvoiceId,
  uint  Rights,
  CSecurityPrincipal  Principal
);
[C++]
public: void GrantAccess(
  CUserAuth*  Caller,
  String*  InvoiceId,
  unsigned long  Rights,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareInvoice privilege to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice.
Rights
Specifies the rights that are to be granted. See ACCESSRIGHTS.
Principal
Specifies the security principal (user or team) with whom the invoice is to be shared. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Grant access to the security principal
   invoice.GrantAccess(userAuth, strInvoiceId, rights, securityPrincipal);

   // Modify the access for the security principal
   invoice.ModifyAccess(userAuth, strInvoiceId, Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ, securityPrincipal);

   // Revoke access for the security principal
   invoice.RevokeAccess(userAuth, strInvoiceId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class


CRMInvoice.ModifyAccess Method

The ModifyAccess method replaces the access rights on the invoice for the specified security principal. This method also applies to all child objects of the invoice. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the invoice. In this case, only the lack of privileges to a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub ModifyAccess(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal Rights As UInt32,
  ByVal Principal As CSecurityPrincipal
)
[C#]
public void ModifyAccess(
  CUserAuth  Caller,
  string  InvoiceId,
  uint  Rights,
  CSecurityPrincipal  Principal
);
[C++]
public: void ModifyAccess(
  CUserAuth*  Caller,
  String*  InvoiceId,
  unsigned long  Rights,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvShareInvoice privilege to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice.
Rights
Specifies the set of rights that are to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or user who is to be granted access. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web strServer
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web strServer
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Grant access to the security principal
   invoice.GrantAccess(userAuth, strInvoiceId, rights, securityPrincipal);

   // Modify the access for the security principal
   invoice.ModifyAccess(userAuth, strInvoiceId, Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ, securityPrincipal);

   // Revoke access for the security principal
   invoice.RevokeAccess(userAuth, strInvoiceId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class


CRMInvoice.Retrieve Method

The Retrieve method retrieves an invoice.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  InvoiceId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  InvoiceId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadInvoice privilege to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice that is to be retrieved.
ColumnSetXml
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in invoice.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the invoice information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by invoice.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>invoicenumber</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the invoice
   string strResultXml = invoice.Retrieve(userAuth, strInvoiceId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class
  • RetrieveByObject
  • RetrieveByPrincipal
  • RetrieveContacts
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipalsAndAccess


CRMInvoice.RetrieveByObject Method

The RetrieveByObject method retrieves all invoices that are associated with a specific object (account, contact, or opportunity). Only those invoices in the states that you specify are retrieved.

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal StateCodes As Integer(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  int[]  StateCodes,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  long  StateCodes __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadInvoice privilege to perform this action. See CUserAuth.
Object
Specifies the object (account, contact, or opportunity) to find. See CObjectName.
StateCount
Specifies the number of elements in the StateCodes array.
StateCodes
Specifies an array of state codes to find. See INVOICE_STATE.
ColumnSetXml
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in invoice.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of invoices requested. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<invoices> + invoice1..N + </invoices>

where the XML schema for each invoice is described by invoice.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strOpportunityId = "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strOpportunityId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otOpportunity;

// The array of state codes to find
   int[] arrCodes = new int[] {Microsoft.Crm.Platform.Types.INVOICE_STATE.INS_ACTIVE, Microsoft.Crm.Platform.Types.INVOICE_STATE.INS_CLOSED};

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>invoicenumber</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the invoice by opportunity object
   string strResultsXml = invoice.RetrieveByObject(userAuth, objName, arrCodes, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class
  • Retrieve


CRMInvoice.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves all invoices that are owned by a security principal (user or team). Only those invoices that are in the states you specify are retrieved.

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal Principal As CSecurityPrincipal,
  ByVal StateCodes As Integer(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  Principal,
  int[]  StateCodes,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  Principal,
  long  StateCodes __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadInvoice privilege to perform this action. See CUserAuth.
Principal
Specifies the security principal for whom invoices are to be retrieved. See CSecurityPrincipal.
StateCodes
Specifies an array of state codes to find. See INVOICE_STATE.
ColumnSetXml
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in invoice.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of invoices requested. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<invoices> + invoice1..N + </invoices>

where the XML schema for each invoice is described by invoice.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>invoicenumber</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // The array of state codes to find
   int[] arrCodes = new int[] {Microsoft.Crm.Platform.Types.INVOICE_STATE.INS_ACTIVE, Microsoft.Crm.Platform.Types.INVOICE_STATE.INS_CLOSED};

   // Retrieve the invoices for this security principal
   string strResultsXml = invoice.RetrieveByPrincipal (userAuth, securityPrincipal, arrCodes, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class
  • Retrieve


CRMInvoice.RetrieveContacts Method

The RetrieveContacts method retrieves all contacts that are associated with an invoice.

Syntax

[Visual Basic .NET]
Public Function RetrieveContacts(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveContacts(
  CUserAuth  Caller,
  string  InvoiceId,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveContacts(
  CUserAuth*  Caller,
  String*  InvoiceId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadInvoice and prvReadContact privileges to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice.
ColumnSetXml
Specifies the XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in contact.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of contacts associated with the specified invoice. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<contacts> + contact1..N + </contacts>

where the XML schema for each contact is described by contact.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the contacts for this invoice
   string strResultsXml = invoice.RetrieveContacts(userAuth, strInvoiceId, "");

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class
  • Retrieve


CRMInvoice.RetrievePrincipalAccess Method

The RetrievePrincipalAccess method retrieves the access that a specified security principal has to a specific invoice.

Syntax

[Visual Basic .NET]
Public Function RetrievePrincipalAccess(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal Principal As CSecurityPrincipal
) As UInt32
[C#]
public uint RetrievePrincipalAccess(
  CUserAuth  Caller,
  string  InvoiceId,
  CSecurityPrincipal  Principal
);
[C++]
public: unsigned long RetrievePrincipalAccess(
  CUserAuth*  Caller,
  String*  InvoiceId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadInvoice privilege to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice.
Principal
Specifies the security principal for whom access rights are to be retrieved. See CSecurityPrincipal.

Return Value

Returns a UInt32 type that specifies the rights the security principal is assigned for the invoice. See ACCESSRIGHTS.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve the access for this security principal
   uint access = invoice.RetrievePrincipalAccess(userAuth, strInvoiceId, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class
  • Retrieve
  • RetrieveSharedPrincipalsAndAccess


CRMInvoice.RetrieveSharedPrincipalsAndAccess Method

The RetrieveSharedPrincipalsAndAccess method retrieves all security principals (users or teams) that have access to an invoice and their access rights to that invoice.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipalsAndAccess(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByRef Rights As UInt32()
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipalsAndAccess(
  CUserAuth  Caller,
  string  InvoiceId,
  out uint[]  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipalsAndAccess(
  CUserAuth*  Caller,
  String*  InvoiceId,
  unsigned long*  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadInvoice privilege to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice.
Rights
[out] Specifies an array of rights for the principals that are found. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of security principals that are found. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";
uint[] rights;
Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   securityPrincipals = invoice.RetrieveSharedPrincipalsAndAccess(userAuth, strInvoiceId, out rights);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class
  • Retrieve
  • RetrievePrincipalAccess


CRMInvoice.RevokeAccess Method

The RevokeAccess method revokes access rights to the invoice for the specified security principal. This method also applies to all child objects of the invoice. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the invoice. In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

Syntax

[Visual Basic .NET]
Public Sub RevokeAccess(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal Principal As CSecurityPrincipal
)
[C#]
public void RevokeAccess(
  CUserAuth  Caller,
  string  InvoiceId,
  CSecurityPrincipal  Principal
);
[C++]
public: void RevokeAccess(
  CUserAuth*  Caller,
  String*  InvoiceId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareInvoice privilege to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice.
Principal
Specifies the security principal (user or team) whose access is to be revoked. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Grant access to the security principal
   invoice.GrantAccess(userAuth, strInvoiceId, rights, securityPrincipal);

   // Modify the access for the security principal
   invoice.ModifyAccess(userAuth, strInvoiceId, Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ, securityPrincipal);

   // Revoke access for the security principal
   invoice.RevokeAccess(userAuth, strInvoiceId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoice Class


CRMInvoice.Update Method

The Update method updates an invoice.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal InvoiceXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  InvoiceId,
  string  InvoiceXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  InvoiceId,
  String*  InvoiceXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteInvoice privilege to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice that is to be updated.
InvoiceXml
Specifies the XML string containing the invoice information. The XML schema is described by invoice.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the invoice
   string strInvoiceXml = "<invoice>";
   strInvoiceXml += "<name>New invoice name</name>";
   strInvoiceXml += "</invoice>";

   // Update the invoice
   invoice.Update(userAuth, strInvoiceId, strInvoiceXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMInvoice Class
  • UpdateAndRetrieve


CRMInvoice.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an invoice and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal InInvoiceXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  InvoiceId,
  string  InInvoiceXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  InvoiceId,
  String*  InInvoiceXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteInvoice and prvReadInvoice privileges to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice that is to be updated.
InInvoiceXml
Specifies the XML string containing the invoice information. The XML schema is described by invoice.xsd.

Return Value

Returns a String type that specifies the XML data containing the invoice information. The XML schema is described by invoice.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual dDirectory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoice proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoice invoice = new Microsoft.Crm.Platform.Proxy.CRMInvoice();
invoice.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoice.Url = strDir + "CRMInvoice.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the invoice
   string strInvoiceXml = "<invoice>";
   strInvoiceXml += "<name>invoice updated</name>";
   strInvoiceXml += "</invoice>";

   // Update the invoice, and then retrieve it
   string strResultXml = invoice.UpdateAndRetrieve(userAuth, strInvoiceId, strInvoiceXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMInvoice Class
  • Update


CRMInvoiceDetail Class

The CRMInvoiceDetail class contains methods that you can use to manage invoice details.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMInvoiceDetail
[Visual Basic .NET]
Public Class CRMInvoiceDetail
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMInvoiceDetail : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMInvoiceDetail: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMInvoiceDetail class exposes the following methods.

Method | Description
Create | Creates an invoice detail.
CreateAndRetrieve | Creates an invoice detail and then retrieves it.
Delete | Deletes an invoice detail.
GetQuantityDecimal | Gets the quantity decimal value for a product.
Retrieve | Retrieves an invoice detail.
RetrieveByObject | Retrieves all invoice details that are associated with an object (sales order).
Update | Updates an invoice detail.
UpdateAndRetrieve | Updates an invoice detail and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMInvoiceDetail.Create Method

The Create method creates an invoice detail.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal InvoiceDetailXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  InvoiceDetailXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  InvoiceDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateInvoice and prvAppendToInvoice privileges on the invoice to which the detail is being attached to perform this action. See CUserAuth.
InvoiceDetailXml
Specifies an XML string containing the invoice detail information. The XML schema is described by invoicedetail.xsd.

Return Value

Returns a String type that specifies the ID of the new invoice detail.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoiceDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail invoicedetail = new Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail();
invoicedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoicedetail.Url = strDir + "CRMInvoiceDetail.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the invoice detail
   string strInvoiceDetail= "<invoicedetail>";
   strInvoiceDetail += "<description>Invoice description</description>";
   strInvoiceDetail += "<invoiceid>" + strInvoiceId + "</invoiceid>";
   strInvoiceDetail += "</invoicedetail>";

   // Create the invoice detail
   // Note: To make this work, userAuth must have edit privileges on the parent invoice
   string strInvoiceDetailId = invoicedetail.Create(userAuth, strInvoiceDetail);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMInvoiceDetail Class
  • Update


CRMInvoiceDetail.CreateAndRetrieve Method

The CreateAndRetrieve method creates an invoice detail and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InInvoiceDetailXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InInvoiceDetailXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InInvoiceDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateInvoice, prvAppendToInvoice, and prvReadInvoice privileges to perform this action. See CUserAuth.
InInvoiceDetailXml
Specifies an XML string containing the invoice detail information. The XML schema is described by invoicedetail.xsd.

Return Value

Returns a String type that specifies the XML data containing the complete invoice detail information. The XML schema is described by invoicedetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoiceDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail invoicedetail = new Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail();
invoicedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoicedetail.Url = strDir + "CRMInvoiceDetail.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the invoice detail
   string strInvoiceDetail= "<invoicedetail>";
   strInvoiceDetail += "<description>desc1</description>";
   strInvoiceDetail += "<invoiceid>" + strInvoiceId + "</invoiceid>";
   strInvoiceDetail += "</invoicedetail>";

   // Create the invoice detail
   // Note: To make this work, userAuth must have edit privileges on the parent invoice
   string strInvoiceDetailXml = invoicedetail.CreateAndRetrieve(userAuth, strInvoiceDetail);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMInvoiceDetail Class
  • UpdateAndRetrieve


CRMInvoiceDetail.Delete Method

The Delete method deletes an invoice detail.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal InvoiceDetailId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  InvoiceDetailId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  InvoiceDetailId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteInvoice privilege to perform this action. See CUserAuth.
InvoiceDetailId
Specifies the ID of the invoice detail that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoiceDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail invoicedetail = new Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail();
invoicedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoicedetail.Url = strDir + "CRMInvoiceDetail.srf";

string strErrorMsg;
string strInvoiceDetailId = "{AP22D809-J752-8855-A2B0-51494C6957C3}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the invoice detail
   invoicedetail.Delete(userAuth, strInvoiceDetailId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoiceDetail Class


CRMInvoiceDetail.GetQuantityDecimal Method

The GetQuantityDecimal method gets the quantity decimal value for a product.

Syntax

[Visual Basic .NET]
Public Function GetQuantityDecimal(
  ByVal Caller As CUserAuth,
  ByVal InvoiceId As String,
  ByVal ProductId As String,
  ByVal UoMId As String
) As Integer
[C#]
public int GetQuantityDecimal(
  CUserAuth  Caller,
  string  InvoiceId,
  string  ProductId,
  string  UoMId
);
[C++]
public: long GetQuantityDecimal(
  CUserAuth*  Caller,
  String*  InvoiceId,
  String*  ProductId,
  String*  UoMId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadInvoice privilege to perform this action. See CUserAuth.
InvoiceId
Specifies the ID of the invoice.
ProductId
Specifies the ID of the product.
UoMId
Specifies the ID of the unit of measure.

Return Value

Returns an Int32 type that specifies the quantity decimal value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoiceDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail invoicedetail = new Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail();
invoicedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoicedetail.Url = strDir + "CRMInvoiceDetail.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";
string strProductId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strUoMId = "{E0B38CBE-91BB-4863-8F4F-76785CE705D2}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Get the quantity
   int quantity = invoicedetail.GetQuantityDecimal(userAuth, strInvoiceId, strProductId, strUoMId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoiceDetail Class


CRMInvoiceDetail.Retrieve Method

The Retrieve method retrieves an invoice detail.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal InvoiceDetailId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  InvoiceDetailId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  InvoiceDetailId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadInvoice privilege to perform this action. See CUserAuth.
InvoiceDetailId
Specifies the ID of the invoice detail that is to be retrieved.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in invoicedetail.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the invoice detail information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by invoicedetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoiceDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail invoicedetail = new Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail();
invoicedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoicedetail.Url = strDir + "CRMInvoiceDetail.srf";

string strErrorMsg;
string strInvoiceDetailId = "{AP22D809-J752-8855-A2B0-51494C6957C3}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>quantity</column>";
   strColumnSetXml += "<column>priceperunit</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the invoice detail
   string strInvoiceDetailXml = invoicedetail.Retrieve(userAuth, strInvoiceDetailId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoiceDetail Class
  • RetrieveByObject


CRMInvoiceDetail.RetrieveByObject Method

The RetrieveByObject method retrieves all invoice detail objects that are associated with the specified object (sales order).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadInvoice privilege to perform this action. See CUserAuth.
Object
Specifies the object (sales order). See CObjectName.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in invoicedetail.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of invoice details associated with the specified sales order. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<invoicedetails> + invoicedetail1..N + </invoicedetails>

where the XML schema for each invoice detail is described by invoicedetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoiceDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail invoicedetail = new Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail();
invoicedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoicedetail.Url = strDir + "CRMInvoiceDetail.srf";

string strErrorMsg;
string strInvoiceId = "{A9920C07-EE2A-3434-A7EC-9J9D240CF535}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strInvoiceId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otInvoice;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>quantity</column>";
   strColumnSetXml += "<column>priceperunit</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the invoice details for this invoice
   string strInvoiceDetailsXml = invoicedetail.RetrieveByObject(userAuth, objName, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMInvoiceDetail Class
  • Retrieve


CRMInvoiceDetail.Update Method

The Update method updates an invoice detail.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal InvoiceDetailId As String,
  ByVal InvoiceDetailXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  InvoiceDetailId,
  string  InvoiceDetailXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  InvoiceDetailId,
  String*  InvoiceDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteInvoice privilege to perform this action. See CUserAuth.
InvoiceDetailId
Specifies the ID of the invoice detail that is to be updated.
InvoiceDetailXml
Specifies an XML string containing the invoice detail information. The XML schema is described by invoicedetail.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoiceDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail invoicedetail = new Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail();
invoicedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoicedetail.Url = strDir + "CRMInvoiceDetail.srf";

string strErrorMsg;
string strInvoiceDetailId = "{AP22D809-J752-8855-A2B0-51494C6957C3}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the invoice detail
   string strInvoiceDetail = "<invoicedetail>";
   strInvoiceDetail += "<description>New description</description>";
   strInvoiceDetail += "</invoicedetail>";

   // Update the invoice detail
   invoicedetail.Update(userAuth, strInvoiceDetailId, strInvoiceDetail);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMInvoiceDetail Class
  • UpdateAndRetrieve


CRMInvoiceDetail.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an invoice detail and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InvoiceDetailId As String,
  ByVal InInvoiceDetailXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  InvoiceDetailId,
  string  InInvoiceDetailXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  InvoiceDetailId,
  String*  InInvoiceDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteInvoice and prvReadInvoice privileges to perform this action. See CUserAuth.
InvoiceDetailId
Specifies the ID of the invoice detail that is to be updated.
InInvoiceDetailXml
Specifies an XML string containing the invoice detail information. The XML schema is described by invoicedetail.xsd.

Return Value

Returns a String type that specifies the XML data containing the complete invoice detail information. The XML schema is described by invoicedetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMInvoiceDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail invoicedetail = new Microsoft.Crm.Platform.Proxy.CRMInvoiceDetail();
invoicedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
invoicedetail.Url = strDir + "CRMInvoiceDetail.srf";

string strErrorMsg;
string strInvoiceDetailId = "{AP22D809-J752-8855-A2B0-51494C6957C3}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the invoice detail
   string strInvoiceDetail = "<invoicedetail>";
   strInvoiceDetail += "<description>desc 2</description>";
   strInvoiceDetail += "</invoicedetail>";

   // Update and then retrieve the invoice detail
   string strInvoiceDetailXml = invoicedetail.UpdateAndRetrieve(userAuth, strInvoiceDetailId, strInvoiceDetail);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMInvoiceDetail Class
  • Update


CRMLead Class

The CRMLead class contains methods that you can use to manage leads.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMLead
[Visual Basic .NET]
Public Class CRMLead
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMLead : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMLead: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMLead class exposes the following methods,

Method | Description
Accept | Accepts a lead that is being reassigned.
Assign | Assigns a lead to a new security principal (user or team).
AssignPendingAcceptance | Assigns a lead to a new security principal (user or team) pending acceptance from the assignee.
BulkRetrieve | Retrieves multiple leads by ID.
Create | Creates a new lead.
CreateAndRetrieve | Creates a new lead and then retrieves it.
Disqualify | Sets the state of a lead to Disqualified.
Delete | Deletes a lead.
GrantAccess | Grants a user or team access to a lead.
MakePrivate | Makes a lead private.
MakePublic | Makes a lead public.
ModifyAccess | Replaces the access rights on the lead for the specified security principal.
Open | Sets the state of a lead to Open.
Qualify | Sets the state of a lead to Qualified.
Recall | Recalls a lead.
Reject | Rejects a lead that is being reassigned.
RemoveAssociation | Eliminates the association between a lead and an object (contact or account).
Retrieve | Retrieves a lead by ID.
RetrieveByObject | Retrieves all leads that are associated with the specified object (contact or account).
RetrieveByPrincipal | Retrieves all of the leads that are owned by the specified security principal.
RetrievePrincipalAccess | Retrieves the access the specified security principal has for a specific lead.
RetrieveSharedPrincipals | Retrieves all of the security principals (users or teams) that have access to a lead.
RetrieveSharedPrincipalsAndAccess | Retrieves all of the security principals (users or teams) that have access to a lead and their access rights for that lead.
RevokeAccess | Revokes the access of a user or team to a lead.
SetAssociation | Establishes an association between an object (contact or account) and a lead.
Update | Updates an existing lead.
UpdateAndRetrieve | Updates an existing lead and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMLead.Accept Method

The Accept method accepts a lead that is being reassigned. This completes the action of assigning a lead to a new security principal.

Syntax

[Visual Basic .NET]
Public Sub Accept(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String
)
[C#]
public void Accept(
  CUserAuth  Caller,
  string  LeadId
);
[C++]
public: void Accept(
  CUserAuth*  Caller,
  String*  LeadId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be accepted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the lead to the security principal, pending acceptance
   lead.AssignPendingAcceptance(userAuth, strLeadId, securityPrincipal);

   // Accept the assignment
   lead.Accept(userAuth, strLeadId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class
  • Reject


CRMLead.Assign Method

The Assign method assigns the lead to a security principal (user or team). (See Remarks.) This method also applies to the parent object and associated objects that have the same owner as the parent object. Therefore when you assign the parent object to a new owner, only the associated objects that have the same owner as the parent object are assigned. In addition, when an object is assigned to a new owner, it is shared with the previous owner with full rights. Either the new owner or the previous owner can remove the relationship or lower the level of privileges the previous owner had on the object.

Syntax

[Visual Basic .NET]
Public Sub Assign(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Assignee As CSecurityPrincipal
)
[C#]
public void Assign(
  CUserAuth  Caller,
  string  LeadId,
  CSecurityPrincipal  Assignee
);
[C++]
public: void Assign(
  CUserAuth*  Caller,
  String*  LeadId,
  CSecurityPrincipal*  Assignee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be assigned.
Assignee
Specifies the new owner of the lead. It can be a user or a team. See CSecurityPrincipal.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not support business-object assignment to teams. Therefore, any solutions built by using this method are not supported by the Microsoft CRM application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the lead to another security principal
   lead.Assign(userAuth, strLeadId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • AssignPendingAcceptance
  • CRMLead Class


CRMLead.AssignPendingAcceptance Method

The AssignPendingAcceptance method assigns a lead to a new security principal (user or team) pending acceptance from the assignee. The assignee can either accept (Accept method) or reject (Reject method) assignment of the lead.

Syntax

[Visual Basic .NET]
Public Sub AssignPendingAcceptance(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Assignee As CSecurityPrincipal
)
[C#]
public void AssignPendingAcceptance(
  CUserAuth  Caller,
  string  LeadId,
  CSecurityPrincipal  Assignee
);
[C++]
public: void AssignPendingAcceptance(
  CUserAuth*  Caller,
  String*  LeadId,
  CSecurityPrincipal*  Assignee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be assigned.
Assignee
Specifies the new owner of the lead. It can be a user or a team. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the lead to the security principal, pending acceptance
   lead.AssignPendingAcceptance(userAuth, strLeadId, securityPrincipal);
}

catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Accept
  • Assign
  • CRMLead Class
  • Reject


CRMLead.BulkRetrieve Method

The BulkRetrieve method retrieves multiple leads by ID.

Syntax

[Visual Basic .NET]
Public Function BulkRetrieve(
  ByVal Caller As CUserAuth,
  ByVal Ids As String(),
  ByVal ColumnSet As String
) As String
[C#]
public string BulkRetrieve(
  CUserAuth  Caller,
  string[]  Ids,
  string  ColumnSet
);
[C++]
public: String* BulkRetrieve(
  CUserAuth*  Caller,
  String*  Ids __gc[],
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLead privilege to perform this action. See CUserAuth.
Ids
Specifies an array of IDs that is to be retrieved.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in lead.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested lead information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<leads> + lead1..N + </leads>

where the XML schema for each lead is described by lead.xsd.

Remarks

The array of IDs passed in must not have any empty elements.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strLeadId2 = "{72D46F0C-3855-4CA2-96E9-498E9BA08665}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string[]leads = new string[2];
   leads[0] = strLeadId;
   leads[1] = strLeadId2;

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>firstname</column>";
   strColumnSetXml += "<column>lastname</column>";
   strColumnSetXml += "</columnset>";

   string strXmlLeads = lead.BulkRetrieve(userAuth, leads, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class


CRMLead.Create Method

The Create method creates a new lead.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal LeadXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  LeadXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  LeadXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateLead privilege to perform this action. See CUserAuth.
LeadXML
Specifies an XML string containing the lead information. The XML schema is described by lead.xsd.

Return Value

Returns a String type that specifies the ID of the newly created lead.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
   // strServer should be set with the name of the platform Web server
   string strServer = "myservername";

   // virtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string virtualDirectory = "mscrmservices";
   string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

   // BizUser proxy object
   Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
   bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
   bizUser.Url = strDir + "BizUser.srf";

   // CRMLead proxy object
   Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
   lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
   lead.Url = strDir + "CRMLead.srf";

   string strErrorMsg;
   try
   {
      Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

      // Set up the XML string for a new lead
      string strLeadXml = "<lead>";
      strLeadXml += "<lastname>Li</lastname>";
      strLeadXml += "<firstname>Yan</firstname>";
      strLeadXml += "<companyname>Northwind Traders</companyname>";
      strLeadXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
      strLeadXml += userAuth.UserId + "</ownerid>";
      strLeadXml += "</lead>";

      string strLeadId = lead.Create(userAuth, strLeadXml);
   }
   catch (System.Web.Services.Protocols.SoapException err)
   {
      // Process the platform error here
      strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
   }
   catch (Exception err)
   {
      // Process other errors here
      strErrorMsg = ("ErrorMessage: " + err.Message );
   }

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMLead Class
  • Update


CRMLead.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new lead and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InLeadXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InLeadXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InLeadXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateLead and prvReadLead privileges to perform this action. See CUserAuth.
InLeadXML
Specifies an XML string containing the lead information. The XML schema is described by lead.xsd.

Return Value

Returns a String type that specifies the XML data containing the requested lead information. The XML schema is described by lead.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for a new lead
   string strLeadXml = "<lead>";
   strLeadXml += "<lastname>Li</lastname>";
   strLeadXml += "<firstname>Yan</firstname>";
   strLeadXml += "<companyname>Northwind Traders</companyname>";
   strLeadXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strLeadXml += userAuth.UserId + "</ownerid>";
   strLeadXml += "</lead>";

   // Now create and then retrieve the lead
   string strNewLeadXml = lead.CreateAndRetrieve(userAuth, strLeadXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMLead Class
  • UpdateAndRetrieve


CRMLead.Delete Method

The Delete method deletes a lead.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  LeadId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  LeadId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now delete the lead
   lead.Delete(userAuth, strLeadId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class


CRMLead.Disqualify Method

The Disqualify method sets the state of a lead to Disqualified.

Syntax

[Visual Basic .NET]
Public Sub Disqualify(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Status As Integer
)
[C#]
public void Disqualify(
  CUserAuth  Caller,
  string  LeadId,
  int  Status
);
[C++]
public: void Disqualify(
  CUserAuth*  Caller,
  String*  LeadId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be disqualified.
Status
Specifies the status of the lead. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Disqualify the lead
   lead.Disqualify (userAuth, strLeadId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class


CRMLead.GrantAccess Method

The GrantAccess method grants a security principal access to the specified lead. This method also applies to all child objects of the lead. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the lead. In this case, only the lack of privileges for a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub GrantAccess(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void GrantAccess(
  CUserAuth  Caller,
  string  LeadId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void GrantAccess(
  CUserAuth*  Caller,
  String*  LeadId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be shared.
Rights
Specifies the rights that are to be granted. See ACCESSRIGHTS.
Grantee
Specifies the security principal (user or team) with whom the lead is to be shared. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Grant the user access to the lead
   lead.GrantAccess(userAuth, strLeadId, rights, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class


CRMLead.MakePrivate Method

The MakePrivate method makes a lead unavailable to anyone except the owner and the users that share the object. Only the owner of a lead can make it private. (By default, all objects are public. See Remarks.)

Syntax

[Visual Basic .NET]
Public Sub MakePrivate(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String
)
[C#]
public void MakePrivate(
  CUserAuth  Caller,
  string  LeadId
);
[C++]
public: void MakePrivate(
  CUserAuth*  Caller,
  String*  LeadId
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the owner and have the prvWriteLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be made private.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if an object is made private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make the lead private
   lead.MakePrivate(userAuth, strLeadId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class
  • MakePublic


CRMLead.MakePublic Method

The MakePublic method makes a lead available to all users. Only the owner of a lead can make it public. By default, all objects are public. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub MakePublic(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String
)
[C#]
public void MakePublic(
  CUserAuth  Caller,
  string  LeadId
);
[C++]
public: void MakePublic(
  CUserAuth*  Caller,
  String*  LeadId
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the owner and have the prvWriteLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be made public.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if an object is made private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make the lead public
   lead.MakePublic(userAuth, strLeadId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class
  • MakePrivate


CRMLead.ModifyAccess Method

The ModifyAccess method replaces the access rights on the lead for the specified security principal. This method also applies to all child objects of the lead. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the lead. In this case, only the lack of privileges to a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub ModifyAccess(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void ModifyAccess(
  CUserAuth  Caller,
  string  LeadId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void ModifyAccess(
  CUserAuth*  Caller,
  String*  LeadId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareLead privilege and be the owner of the object to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead.
Rights
Specifies the set of rights that are to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or user that is to be granted access. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Change the access rights to the lead for the security principal
   lead.ModifyAccess(userAuth, strLeadId, rights, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class


CRMLead.Open Method

The Open method sets the state of a lead to Open.

Syntax

[Visual Basic .NET]
Public Sub Open(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Status As Integer
)
[C#]
public void Open(
  CUserAuth  Caller,
  string  LeadId,
  int  Status
);
[C++]
public: void Open(
  CUserAuth*  Caller,
  String*  LeadId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be opened.
Status
Specifies the status of the lead. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Disqualify the lead; this is necessary to set the state to Open
   lead.Disqualify(userAuth, strLeadId, -1);

   // Now open the lead
   lead.Open(userAuth, strLeadId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class


CRMLead.Qualify Method

The Qualify method sets the state of a lead to Qualified.

Syntax

[Visual Basic .NET]
Public Sub Qualify(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Status As Integer
)
[C#]
public void Qualify(
  CUserAuth  Caller,
  string  LeadId,
  int  Status
);
[C++]
public: void Qualify(
  CUserAuth*  Caller,
  String*  LeadId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be qualified.
Status
Specifies the status of the lead. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now qualify the lead
   lead.Qualify(userAuth, strLeadId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class


CRMLead.Recall Method

The Recall method recalls a lead. A lead can be recalled when it has been assigned to a user or team but has not yet been accepted.

Syntax

[Visual Basic .NET]
Public Sub Recall(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Principal As CSecurityPrincipal
)
[C#]
public void Recall(
  CUserAuth  Caller,
  string  LeadId,
  CSecurityPrincipal  Principal
);
[C++]
public: void Recall(
  CUserAuth*  Caller,
  String*  LeadId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be recalled.
Principal
Specifies the security principal from whom the lead is to be recalled. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the lead, pending acceptance.
   lead.AssignPendingAcceptance(userAuth, strLeadId, securityPrincipal);

   // Now recall the lead
   lead.Recall(userAuth, strLeadId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class


CRMLead.Reject Method

The Reject method rejects a lead that is being reassigned. This cancels the assignment of the lead to the specified security principal.

Syntax

[Visual Basic .NET]
Public Sub Reject(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String
)
[C#]
public void Reject(
  CUserAuth  Caller,
  string  LeadId
);
[C++]
public: void Reject(
  CUserAuth*  Caller,
  String*  LeadId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is being rejected.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the lead, pending acceptance
   lead.AssignPendingAcceptance(userAuth, strLeadId, securityPrincipal);

   // Now reject the lead
   lead.Reject(userAuth, strLeadId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class
  • Accept


CRMLead.RemoveAssociation Method

The RemoveAssociation method eliminates the association between a lead and an object (contact or an account).

Syntax

[Visual Basic .NET]
Public Sub RemoveAssociation(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Object As CObjectName
)
[C#]
public void RemoveAssociation(
  CUserAuth  Caller,
  string  LeadId,
  CObjectName  Object
);
[C++]
public: void RemoveAssociation(
  CUserAuth*  Caller,
  String*  LeadId,
  CObjectName*  Object
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendLead and either prvAppendToAccount or prvAppendToContact privileges to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead.
Object
Specifies the object (contact or account) that is to be disassociated from the lead. See CObjectName.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create an object name
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Remove the association with the account object
   lead.RemoveAssociation (userAuth, strLeadId, objName);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class
  • SetAssociation


CRMLead.Retrieve Method

The Retrieve method retrieves a lead by ID.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  LeadId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  LeadId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in lead.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested lead information. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by lead.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now retrieve this lead
   // Passing in a null string for ColumnSet retrieves all columns
   string strNewLeadXml = lead.Retrieve(userAuth, strLeadId, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class
  • RetrieveByObject
  • RetrieveByPrincipal
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipals
  • RetrieveSharedPrincipalsAndAccess


CRMLead.RetrieveByObject Method

The RetrieveByObject method retrieves all leads that are associated with the specified object (contact or account).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLead privilege to perform this action. See CUserAuth.
Object
Specifies the object (contact or account) for which leads are to be retrieved. See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in lead.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of leads associated with the specified object (contact or account). The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<leads> + lead1..N + </leads>

where the XML schema for each lead is described by lead.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create an object name
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Set an association with the account object
   lead.SetAssociation (userAuth, strLeadId, objName);

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>leadid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve all of the leads for the specified object
   string strLeadsXml = lead.RetrieveByObject(userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class
  • Retrieve


CRMLead.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves all leads that are owned by the specified security principal.

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal Principal As CSecurityPrincipal,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  Principal,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  Principal,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLead privilege to perform this action. See CUserAuth.
Principal
Specifies the security principal for which leads are to be retrieved. See CSecurityPrincipal.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in lead.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of leads requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<leads> + lead1..N + </leads>

where the XML schema for each lead is described by lead.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>leadid</column>";
   strColumnSetXml += "</columnset>";

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve all of the leads for the specified security principal
   string strLeadsXml = lead.RetrieveByPrincipal(userAuth, securityPrincipal, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class
  • Retrieve


CRMLead.RetrievePrincipalAccess Method

The RetrievePrincipalAccess method retrieves the access the security principal has for the specified lead.

Syntax

[Visual Basic .NET]
Public Function RetrievePrincipalAccess(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Principal As CSecurityPrincipal
) As UInt32
[C#]
public uint RetrievePrincipalAccess(
  CUserAuth  Caller,
  string  LeadId,
  CSecurityPrincipal  Principal
);
[C++]
public: unsigned long RetrievePrincipalAccess(
  CUserAuth*  Caller,
  String*  LeadId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead.
Principal
Specifies the security principle. See CSecurityPrincipal.

Return Value

Returns a UInt32 type that specifies the rights the principal has for the lead. See ACCESSRIGHTS.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve the access rights for this principal
   uint access = lead.RetrievePrincipalAccess(userAuth, strLeadId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class
  • Retrieve


CRMLead.RetrieveSharedPrincipals Method

The RetrieveSharedPrincipals method retrieves all of the security principals (users or teams) that have access to a lead.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipals(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Rights As UInt32
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipals(
  CUserAuth  Caller,
  string  LeadId,
  uint  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipals(
  CUserAuth*  Caller,
  String*  LeadId,
  unsigned long  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead.
Rights
Specifies the rights for access to this lead. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies an array of security principals requested. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;

   securityPrincipals = lead.RetrieveSharedPrincipals(userAuth, strLeadId, Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class
  • Retrieve
  • RetrieveSharedPrincipalsAndAccess


CRMLead.RetrieveSharedPrincipalsAndAccess Method

The RetrieveSharedPrincipalsAndAccess method retrieves all of the security principals (users or teams) that have access to a lead and their access rights for the lead.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipalsAndAccess(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByRef Rights As UInt32()
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipalsAndAccess(
  CUserAuth  Caller,
  string  LeadId,
  out uint[]  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipalsAndAccess(
  CUserAuth*  Caller,
  String*  LeadId,
  unsigned long*  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead.
Rights
[out] Specifies an array of rights for the principals. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of principals requested. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;
   uint[] rights;

   securityPrincipals = lead.RetrieveSharedPrincipalsAndAccess(userAuth, strLeadId, out rights);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class
  • Retrieve
  • RetrieveSharedPrincipals


CRMLead.RevokeAccess Method

The RevokeAccess method revokes access rights to the lead for the specified security principal. This method also applies to all child objects of the lead. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the lead. In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

Syntax

[Visual Basic .NET]
Public Sub RevokeAccess(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Revokee As CSecurityPrincipal
)
[C#]
public void RevokeAccess(
  CUserAuth  Caller,
  string  LeadId,
  CSecurityPrincipal  Revokee
);
[C++]
public: void RevokeAccess(
  CUserAuth*  Caller,
  String*  LeadId,
  CSecurityPrincipal*  Revokee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead.
Revokee
Specifies the security principal (user or team) whose access is to be revoked. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Now revoke access
   lead.RevokeAccess(userAuth, strLeadId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class


CRMLead.SetAssociation Method

The SetAssociation method establishes an association between an object (contact or an account) and a lead.

Syntax

[Visual Basic .NET]
Public Sub SetAssociation(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal Object As CObjectName
)
[C#]
public void SetAssociation(
  CUserAuth  Caller,
  string  LeadId,
  CObjectName  Object
);
[C++]
public: void SetAssociation(
  CUserAuth*  Caller,
  String*  LeadId,
  CObjectName*  Object
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendLead and either prvAppendToAccount or prvAppendToContact privileges to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead.
Object
Specifies the object (account or contact) that is to be to be associated with the lead. See CObjectName.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create an object name
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Set association with the account object
   lead.SetAssociation (userAuth, strLeadId, objName);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLead Class
  • RemoveAssociation


CRMLead.Update Method

The Update method updates an existing lead.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal LeadXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  LeadId,
  string  LeadXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  LeadId,
  String*  LeadXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteLead privilege to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be updated.
LeadXML
Specifies an XML string containing the lead information. The XML schema is described by lead.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Update the XML string for the lead
   string strLeadXml = "<lead>";
   strLeadXml += "<firstname>George</firstname>";
   strLeadXml += "</lead>";

   // Now update the lead
   lead.Update(userAuth, strLeadId, strLeadXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMLead Class
  • UpdateAndRetrieve


CRMLead.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an existing lead and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal LeadId As String,
  ByVal InLeadXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  LeadId,
  string  InLeadXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  LeadId,
  String*  InLeadXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteLead and prvReadLead privileges to perform this action. See CUserAuth.
LeadId
Specifies the ID of the lead that is to be updated.
InLeadXML
Specifies an XML string containing the lead information. The XML schema is described by lead.xsd.

Return Value

Returns a String type that specifies the XML data containing the requested lead information. The XML schema is described by lead.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLead proxy object
Microsoft.Crm.Platform.Proxy.CRMLead lead = new Microsoft.Crm.Platform.Proxy.CRMLead ();
lead.Credentials = System.Net.CredentialCache.DefaultCredentials;
lead.Url = strDir + "CRMLead.srf";

string strErrorMsg;
string strLeadId = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Update the XML string for the lead
   string strLeadXml = "<lead>";
   strLeadXml += "<firstname>George</firstname>";
   strLeadXml += "</lead>";

   // Now update and then retrieve the lead
   string strNewLeadXml = lead.UpdateAndRetrieve(userAuth, strLeadId, strLeadXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMLead Class
  • Update


CRMLicense Class

The CRMLicense class contains methods that you can use to manage software licenses.

Note For more information about licenses, see the Licenses section of Microsoft CRM Object Model.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMLicense
[Visual Basic .NET]
Public Class CRMLicense
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMLicense : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMLicense: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMLicense class exposes the following methods.

Method | Description
AddDeploymentLicense | Adds the specified license to a deployment.
AddSetupUser | For internal use only.
CheckValidLicenseCombination | Checks whether the specified license combination is valid for a user.
DeleteDeploymentLicense | Deletes the specified license from a deployment.
GetAvailableLicenseCount | Retrieves the number of available (ungranted) licenses of a particular license type for an organization.
GetDeploymentLicenses | Retrieves all of the licenses for a deployment.
GetDeploymentLicensesEx | Retrieves all of the licenses for a deployment. This method includes a parameter to specify the columns to be retrieved.
GetGrantedLicenseCount | Returns the number of licenses of a particular type that have been granted in an organzation.
GetPurchasedLicenseCount | Returns the total number of licenses of a particular type that have been purchased by an organization.
GetUserLicenses | Retrieves all of the licenses for a user.
GetUserUnassignedLicenses | Retrieves all of the unassigned licenses for a user.
GrantUserLicense | Grants a license to a user.
IsLicenseValidForDeployment | Checks whether the specified license is valid for the deployment.
IsLicenseValidForUser | Checks whether the specified license is valid for the user.
RevokeUserLicense | Revokes a the license for a user.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes
  • License Names


License Names

In the CRMLicense methods, each license is referenced by its GUID. The following table shows the mapping between the license name and the GUID.

License name | GUID
Microsoft CRM Sales Standard | 4F32A556-8B6A-4937-B94D-E5117C70C614
Microsoft CRM Sales Professional | F0040B11-E891-47F9-8CF1-0F427BD50B6C
Microsoft CRM Customer Service Standard | C000EA1A-6343-4F78-BB38-4D00636BB70B
Microsoft CRM Customer Service Professional | 0297DDD7-80F8-4F5F-AAAA-DF3B761DDB14
Microsoft CRM Suite Standard | 1A117266-BD21-4799-B90B-1B234BC747E2
Microsoft CRM Suite Professional | 59F6D48E-F7E8-46F3-806C-3CA992D21915


CRMLicense.AddDeploymentLicense Method

The AddDeploymentLicense method adds the specified software license to a deployment. The caller must be a domain administrator when the first license is added to a deployment.

Syntax

[Visual Basic .NET]
Public Sub AddDeploymentLicense(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal LicenseType As String,
  ByVal LicenseKey As String
)
[C#]
public void AddDeploymentLicense(
  CUserAuth  Caller,
  string  OrganizationId,
  string  LicenseType,
  string  LicenseKey
);
[C++]
public: void AddDeploymentLicense(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  LicenseType,
  String*  LicenseKey
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteLicense privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
LicenseType
Specifies the ID of the license type.
LicenseKey
Specifies the ID of the license key.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";

// Valid license key
string LicenseKey = "{QFL6W8JZ-TU8U-0NU6-1JKH-807F897C5027}";

// Valid organization ID
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

// Microsoft CRM Suite Professional
string LicenseType = "{59F6D48E-F7E8-46F3-806C-3CA992D21915}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Call AddDeploymentLicense
   license.AddDeploymentLicense(userAuth, strOrgId, LicenseType, LicenseKey);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class


CRMLicense.CheckValidLicenseCombination Method

The CheckValidLicenseCombination method checks whether the specified software license combination is valid for a user.

Syntax

[Visual Basic .NET]
Public Function CheckValidLicenseCombination(
  ByVal LicenseArray As String()
) As Integer
[C#]
public int CheckValidLicenseCombination(
  string[]  LicenseArray
);
[C++]
public: long CheckValidLicenseCombination(
  String*  LicenseArray __gc[]
);

Parameters

LicenseArray
Specifies an array of license IDs. See License Names for the set of license IDs.

Return Value

Returns an Int32 type that is 1 if the software license combination is valid or is 0 if the license combination is not valid.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";
string[] vlicense = new String[2]
      {
         "{C000EA1A-6343-4F78-BB38-4D00636BB70B}",   // Standard CS
         "{4F32A556-8B6A-4937-B94D-E5117C70C614}"   // Standard SFA
      };

int vlicenseCount = -1;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   vlicenseCount = license.CheckValidLicenseCombination(vlicense);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class


CRMLicense.DeleteDeploymentLicense Method

The DeleteDeploymentLicense method deletes the specified software license from a deployment.

Syntax

[Visual Basic .NET]
Public Sub DeleteDeploymentLicense(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal LicenseType As String
)
[C#]
public void DeleteDeploymentLicense(
  CUserAuth  Caller,
  string  OrganizationId,
  string  LicenseType
);
[C++]
public: void DeleteDeploymentLicense(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  LicenseType
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteLicense privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
LicenseType
Specifies the ID of the license type.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";

// Valid organization ID
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";
string LicenseType = "{59F6D48E-F7E8-46F3-806C-3CA992D21915}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now delete the deployment license
   license.DeleteDeploymentLicense (userAuth, strOrgId, LicenseType);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class


CRMLicense.GetAvailableLicenseCount Method

The GetAvailableLicenseCount method retrieves the number of available (un-granted) software licenses of a particular license type for an organization.

Syntax

[Visual Basic .NET]
Public Function GetAvailableLicenseCount(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal LicenseType As String
) As Integer
[C#]
public int GetAvailableLicenseCount(
  CUserAuth  Caller,
  string  OrganizationId,
  string  LicenseType
);
[C++]
public: long GetAvailableLicenseCount(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  LicenseType
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLicense privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
LicenseType
Specifies the ID of the license type in which you are interested.

Return Value

Returns an Int32 type that specifies the number of available software licenses.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";
// Valid organization ID
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}" ;
// Microsoft CRM Suite Professional
string LicenseType = "{59F6D48E-F7E8-46F3-806C-3CA992D21915}";

int count = -1;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now retrieve license count
   count = license.GetAvailableLicenseCount(userAuth, strOrgId, LicenseType);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class


CRMLicense.GetDeploymentLicenses Method

The GetDeploymentLicenses method retrieves all of the software licenses for a deployment.

Syntax

[Visual Basic .NET]
Public Function GetDeploymentLicenses(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String
) As String
[C#]
public string GetDeploymentLicenses(
  CUserAuth  Caller,
  string  OrganizationId
);
[C++]
public: String* GetDeploymentLicenses(
  CUserAuth*  Caller,
  String*  OrganizationId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLicense privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.

Return Value

Returns a String type that specifies the XML data containing the software licenses. This XML string is in the format

<licenses> + license1..N + </licenses>

where the XML schema for each license is described by license.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";
// Valid organization ID
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}" ;

string strLicenseXml = "";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now retrieve deployment licenses
   strLicenseXml = license.GetDeploymentLicenses (userAuth, strOrgId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class
  • License Names


CRMLicense.GetDeploymentLicensesEx Method

The GetDeploymentLicensesEX method retrieves all of the software licenses for a deployment. This method includes the ColumnSetXML parameter that allows you to specify which columns are to be retrieved.

Syntax

[Visual Basic .NET]
Public Function GetDeploymentLicensesEx(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string GetDeploymentLicensesEx(
  CUserAuth  Caller,
  string  OrganizationId,
  string  ColumnSetXML
);
[C++]
public: String* GetDeploymentLicensesEx(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLicense privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in license.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the software license information. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<licenses> + license1..N + </licenses>

where the XML schema for each license is described by license.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";

// Valid organization ID
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}" ;
string strLicenseXml = "";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now retrieve license XML data
   strLicenseXml = license.GetDeploymentLicensesEx (userAuth, strOrgId, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class


CRMLicense.GetGrantedLicenseCount Method

The GetGrantedLicenseCount method returns the number of software licenses of a particular license type that have been granted in an organization.

Syntax

[Visual Basic .NET]
Public Function GetGrantedLicenseCount(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal LicenseType As String
) As Integer
[C#]
public int GetGrantedLicenseCount(
  CUserAuth  Caller,
  string  OrganizationId,
  string  LicenseType
);
[C++]
public: long GetGrantedLicenseCount(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  LicenseType
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLicense privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
LicenseType
Specifies the ID of the license type.

Return Value

Returns an Int32 type that specifies the number of software licenses that have been granted.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}"; //Valid Organization Id
string LicenseType = "{59F6D48E-F7E8-46F3-806C-3CA992D21915}"; //Profesional Suite

int lcount = -1;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now retrieve the granted license count
   lcount = license.GetGrantedLicenseCount(userAuth, strOrgId, LicenseType);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class


CRMLicense.GetPurchasedLicenseCount Method

The GetPurchasedLicenseCount method returns the total number of software licenses of a particular license type that have been purchased by an organization.

Syntax

[Visual Basic .NET]
Public Function GetPurchasedLicenseCount(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal LicenseType As String
) As Integer
[C#]
public int GetPurchasedLicenseCount(
  CUserAuth  Caller,
  string  OrganizationId,
  string  LicenseType
);
[C++]
public: long GetPurchasedLicenseCount(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  LicenseType
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLicense privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
LicenseType
Specifies the ID of the license type.

Return Value

Returns an Int32 type that specifies the number of software licenses that have been purchased.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";
// Valid organization ID
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}" ;
// Profesional Suite
string LicenseType = "{59F6D48E-F7E8-46F3-806C-3CA992D21915}";

int lcount = -1;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now retrieve the count
   lcount = license.GetPurchasedLicenseCount(userAuth, strOrgId, LicenseType);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class


CRMLicense.GetUserLicenses Method

The GetUserLicenses method retrieves all of the software licenses for a user.

Syntax

[Visual Basic .NET]
Public Function GetUserLicenses(
  ByVal Caller As CUserAuth,
  ByVal UserId As String
) As String
[C#]
public string GetUserLicenses(
  CUserAuth  Caller,
  string  UserId
);
[C++]
public: String* GetUserLicenses(
  CUserAuth*  Caller,
  String*  UserId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLicense privilege to perform this action. See CUserAuth.
UserId
Specifies ID of the user.

Return Value

Returns a String type that specifies the XML data containing the set of software licenses associated with the specified user. This XML string is in the format

<licenses> + license1..N + </licenses>

where the XML schema for each license is described by license.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";
string strUserLicenses = "";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now retrieve the licenses for the caller
   strUserLicenses = license.GetUserLicenses(userAuth, userAuth.UserId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class
  • License Names


CRMLicense.GetUserUnassignedLicenses Method

The GetUserUnassignedLicenses method retrieves all of the unassigned software licenses for a user.

Syntax

[Visual Basic .NET]
Public Function GetUserUnassignedLicenses(
  ByVal Caller As CUserAuth,
  ByVal UserId As String
) As String
[C#]
public string GetUserUnassignedLicenses(
  CUserAuth  Caller,
  string  UserId
);
[C++]
public: String* GetUserUnassignedLicenses(
  CUserAuth*  Caller,
  String*  UserId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLicense privilege to perform this action. See CUserAuth.
UserId
Specifies ID of the user.

Return Value

Returns a String type that specifies the XML data containing the set of software licenses that are not yet assigned to the user. This XML string is in the format

<licenses> + license1..N + </licenses>

where the XML schema for each license is described by license.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";
string strUserLicenses = "";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now get the unassigned licenses for the user
   strUserLicenses = license.GetUserUnassignedLicenses (userAuth, userAuth.UserId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class
  • License Names


CRMLicense.GrantUserLicense Method

The GrantUserLicense method grants a software license to a user. The caller must be a domain administrator when a license is granted to the first user in the deployment.

Syntax

[Visual Basic .NET]
Public Sub GrantUserLicense(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal LicenseType As String
)
[C#]
public void GrantUserLicense(
  CUserAuth  Caller,
  string  UserId,
  string  LicenseType
);
[C++]
public: void GrantUserLicense(
  CUserAuth*  Caller,
  String*  UserId,
  String*  LicenseType
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvGrantLicense privilege to perform this action. See CUserAuth.
UserId
Specifies ID of the user.
LicenseType
Specifies the ID of the license type.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";
// Microsoft CRM Suite Professional
string LicenseType = "{59F6D48E-F7E8-46F3-806C-3CA992D21915}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now grant the Microsoft CRM Suite Professional license to the caller
   license.GrantUserLicense(userAuth, userAuth.UserId, LicenseType);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class


CRMLicense.IsLicenseValidForDeployment Method

The IsLicenseValidForDeployment method checks whether the specified software license is valid for the deployment.

Syntax

[Visual Basic .NET]
Public Function IsLicenseValidForDeployment(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal LicenseType As String
) As Integer
[C#]
public int IsLicenseValidForDeployment(
  CUserAuth  Caller,
  string  OrganizationId,
  string  LicenseType
);
[C++]
public: long IsLicenseValidForDeployment(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  LicenseType
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLicense privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
LicenseType
Specifies the ID of the license type.

Return Value

Returns an Int32 type that specifies true if the software license is valid.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";
// Valid organization ID
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}" ;
// Microsoft CRM Suite Professional
string LicenseType = "{59F6D48E-F7E8-46F3-806C-3CA992D21915}";

int lvalid = -1;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   / /Now check validity
   lvalid = license.IsLicenseValidForDeployment (userAuth, strOrgId, LicenseType);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class


CRMLicense.IsLicenseValidForUser Method

The IsLicenseValidForUser method checks whether the specified software license is valid for the user.

Syntax

[Visual Basic .NET]
Public Function IsLicenseValidForUser(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal LicenseType As String
) As Integer
[C#]
public int IsLicenseValidForUser(
  CUserAuth  Caller,
  string  UserId,
  string  LicenseType
);
[C++]
public: long IsLicenseValidForUser(
  CUserAuth*  Caller,
  String*  UserId,
  String*  LicenseType
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadLicense privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user.
LicenseType
Specifies the ID of the license type.

Return Value

Returns an Int32 type that specifies true if the software license is valid.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";

// Professional Suite
string LicenseType = "{59F6D48E-F7E8-46F3-806C-3CA992D21915}";
int lvalid = -1;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now check validity
   lvalid = license.IsLicenseValidForUser (userAuth, userAuth.UserId, LicenseType);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class


CRMLicense.RevokeUserLicense Method

The RevokeUserLicense method revokes a software license for a user.

Syntax

[Visual Basic .NET]
Public Sub RevokeUserLicense(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal LicenseType As String
)
[C#]
public void RevokeUserLicense(
  CUserAuth  Caller,
  string  UserId,
  string  LicenseType
);
[C++]
public: void RevokeUserLicense(
  CUserAuth*  Caller,
  String*  UserId,
  String*  LicenseType
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvRevokeLicense privilege to perform this action. See CUserAuth.
UserId
Specifies ID of the user.
LicenseType
Specifies the ID of the license type.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMLicense proxy object
Microsoft.Crm.Platform.Proxy.CRMLicense license = new Microsoft.Crm.Platform.Proxy.CRMLicense();
license.Credentials = System.Net.CredentialCache.DefaultCredentials;
license.Url = strDir + "CRMLicense.srf";

string strErrorMsg = "";

// Microsoft CRM Suite Professional
string LicenseType = "{59F6D48E-F7E8-46F3-806C-3CA992D21915}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now revoke user license
   license.RevokeUserLicense(userAuth, userAuth.UserId, LicenseType);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMLicense Class


CRMNewsArticle Class

The CRMNewsArticle class contains methods that you can use to manage news articles.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMNewsArticle
[Visual Basic .NET]
Public Class CRMNewsArticle
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMNewsArticle : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMNewsArticle: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMNewsArticle class exposes the following methods.

Method | Description
Create | Creates a news article.
CreateAndRetrieve | Creates a news article and then retrieves it.
Delete | Deletes a news article.
Retrieve | Retrieves a news article.
Update | Updates a news article.
UpdateAndRetrieve | Updates a news article and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMNewsArticle.Create Method

The Create method creates a news article.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal ArticleXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  ArticleXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  ArticleXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateNewsArticle privilege to perform this action. See CUserAuth.
ArticleXML
Specifies an XML string representing a news article. The XML schema is described by businessunitnewsarticle.xsd.

Return Value

Returns a String type that specifies the ID of the newly created news article.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNewsArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMNewsArticle  newsarticle = new Microsoft.Crm.Platform.Proxy.CRMNewsArticle();
newsarticle.Credentials = System.Net.CredentialCache.DefaultCredentials;
newsarticle.Url = strDir + "CRMNewsarticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strBusinessUnitId = "{A8D031CA-C250-42B8-BB80-CA1BD47BFD8F}";

   // Set up the XML string for the news article
   string xml = "<businessunitnewsarticle>";
      xml += "<newsarticle>My News Article</newsarticle>";
      xml += "<businessunitid>" + strBusinessUnitId + "</businessunitid>";
      xml += "</businessunitnewsarticle>";

   // Create the news article
   string strArticleId = newsarticle.Create(userAuth, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMNewsArticle Class
  • Update


CRMNewsArticle.CreateAndRetrieve Method

The CreateAndRetrieve method creates a news article and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InArticleXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InArticleXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InArticleXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateNewsArticle and prvReadNewsArticle privileges to perform this action. See CUserAuth.
InArticleXML
Specifies an XML string representing a news article. The XML schema is described by businessunitnewsarticle.xsd.

Return Value

Returns a String type that specifies the XML data representing the newly created news article. The XML schema is described by businessunitnewsarticle.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNewsArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMNewsArticle  newsarticle = new Microsoft.Crm.Platform.Proxy.CRMNewsArticle();
newsarticle.Credentials = System.Net.CredentialCache.DefaultCredentials;
newsarticle.Url = strDir + "CRMNewsarticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strBusinessUnitId = "{A8D031CA-C250-42B8-BB80-CA1BD47BFD8F}";

   // Set up the XML string for the news article
   string xml = "<businessunitnewsarticle>";
   xml += "<newsarticle>My News Article</newsarticle>";
   xml += "<businessunitid>" + strBusinessUnitId + "</businessunitid>";
   xml += "</businessunitnewsarticle>";

   // Create and then retrieve the news article
   string strResultsXml = newsarticle.CreateAndRetrieve(userAuth, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMNewsArticle Class
  • UpdateAndRetrieve


CRMNewsArticle.Delete Method

The Delete method deletes a news article.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ArticleId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ArticleId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ArticleId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteNewsArticle privilege to perform this action. See CUserAuth.
ArticleId
Specifies the ID of the news article to delete.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNewsArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMNewsArticle  newsarticle = new Microsoft.Crm.Platform.Proxy.CRMNewsArticle();
newsarticle.Credentials = System.Net.CredentialCache.DefaultCredentials;
newsarticle.Url = strDir + "CRMNewsarticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strNewsArticleId = "{FLF931CA-C345-68K8-BB80-CA1BD47BFD8F}";

   // Delete the news article
   newsarticle.Delete(userAuth, strNewsArticleId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNewsArticle Class


CRMNewsArticle.Retrieve Method

The Retrieve method retrieves a news article.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal ArticleId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  ArticleId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  ArticleId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadNewsArticle privilege to perform this action. See CUserAuth.
ArticleId
Specifies the ID of the news article that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in businessunitnewsarticle.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the news article. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by businessunitnewsarticle.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNewsArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMNewsArticle  newsarticle = new Microsoft.Crm.Platform.Proxy.CRMNewsArticle();
newsarticle.Credentials = System.Net.CredentialCache.DefaultCredentials;
newsarticle.Url = strDir + "CRMNewsarticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strNewsArticleId = "{FLF931CA-C345-68K8-BB80-CA1BD47BFD8F}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>newsarticle</column>";
   strColumnSetXml += "<column>businessunitid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the news article
   string strResultsXml = newsarticle.Retrieve(userAuth, strNewsArticleId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNewsArticle Class


CRMNewsArticle.Update Method

The Update method updates a news article.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal ArticleId As String,
  ByVal ArticleXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  ArticleId,
  string  ArticleXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  ArticleId,
  String*  ArticleXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteNewsArticle privilege to perform this action. See CUserAuth.
ArticleId
Specifies the ID of the news article that is to be updated.
ArticleXML
Specifies an XML string representing a news article. The XML schema is described by businessunitnewsarticle.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNewsArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMNewsArticle  newsarticle = new Microsoft.Crm.Platform.Proxy.CRMNewsArticle();
newsarticle.Credentials = System.Net.CredentialCache.DefaultCredentials;
newsarticle.Url = strDir + "CRMNewsarticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strNewsArticleId = "{FLF931CA-C345-68K8-BB80-CA1BD47BFD8F}";

   // Set up the XML string for the news article
   string xml = "<businessunitnewsarticle>";
   xml += "<newsarticle>My Updated News Article</newsarticle>";
   xml += "</businessunitnewsarticle>";

   // Update the news article
   newsarticle.Update(userAuth, strNewsArticleId, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMNewsArticle Class
  • UpdateAndRetrieve


CRMNewsArticle.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a news article and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ArticleId As String,
  ByVal InArticleXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  ArticleId,
  string  InArticleXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  ArticleId,
  String*  InArticleXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteNewsArticle and prvReadNewsArticle privileges to perform this action. See CUserAuth.
ArticleId
Specifies the ID of the news article that is to be updated.
InArticleXML
Specifies an XML string representing a news article. The XML schema is described by businessunitnewsarticle.xsd.

Return Value

Returns a String type that specifies the XML data representing the updated news article. The XML schema is described by businessunitnewsarticle.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNewsArticle proxy object
Microsoft.Crm.Platform.Proxy.CRMNewsArticle  newsarticle = new Microsoft.Crm.Platform.Proxy.CRMNewsArticle();
newsarticle.Credentials = System.Net.CredentialCache.DefaultCredentials;
newsarticle.Url = strDir + "CRMNewsarticle.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strNewsArticleId = "{FLF931CA-C345-68K8-BB80-CA1BD47BFD8F}";

   // Set up the XML string for the news article
   string xml = "<businessunitnewsarticle>";
   xml += "<newsarticle>My News Article</newsarticle>";
   xml += "</businessunitnewsarticle>";

   // Update and retrieve the news article
   string strResultsXml = newsarticle.UpdateAndRetrieve(userAuth, strNewsArticleId, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMNewsArticle Class
  • Update


CRMNotesManager Class

The CRMNotesManager class contains methods that you can use to manage note objects.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMNotesManager
[Visual Basic .NET]
Public Class CRMNotesManager
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMNotesManager : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMNotesManager: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMNotesManager class exposes the following methods.

Method | Description
Assign | Assigns ownership of a note to the specified security principal.
Create | Creates a new note.
CreateAndRetrieve | Creates a new note and then returns the XML data for the new note.
Delete | Deletes a note.
GrantAccess | Grants access to a note to the specified security principal.
MakePrivate | Makes a note private.
MakePublic | Makes a note public.
ModifyAccess | Replaces the access rights on the note for the specified security principal.
RemoveBinaryData | Removes the binary attachment from the specified note.
RemoveParent | Removes the parent of an existing note, but leaves the parent and the note otherwise intact.
Retrieve | Retrieves a note.
RetrieveByObject | Retrieves all notes that are associated with the specified object.
RetrieveByPrincipal | Retrieves all notes that are owned by the specified security principal.
RetrievePrincipalAccess | Retrieves the access a specific security principal has for a specific note.
RetrieveSharedPrincipals | Retrieves all users and teams who have the specified access to the specified note.
RetrieveSharedPrincipalsAndAccess | Retrieves all security principals (users or teams) that have access to a note and their access rights for that note.
RevokeAccess | Revokes all access for the security principal.
SetParent | Sets the parent for a note.
Update | Updates an existing note.
UpdateAndRetrieve | Updates an existing note and then returns the XML data for the note.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMNotesManager.Assign Method

The Assign method assigns the note to a security principal (user or team). (See Remarks.) This method also applies to the parent object and associated objects that have the same owner as the parent object. Therefore when you assign the parent object to a new owner, only the associated objects that have the same owner as the parent object are assigned. In addition, when an object is assigned to a new owner, it is shared with the previous owner with full rights. Either the new owner or the previous owner can remove the relationship or lower the level of privileges the previous owner had on the object.

Syntax

[Visual Basic .NET]
Public Sub Assign(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String,
  ByVal Assignee As CSecurityPrincipal
)
[C#]
public void Assign(
  CUserAuth  Caller,
  string  NoteId,
  CSecurityPrincipal  Assignee
);
[C++]
public: void Assign(
  CUserAuth*  Caller,
  String*  NoteId,
  CSecurityPrincipal*  Assignee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note.
Assignee
Specifies the security principal (user or team) to which the note is being assigned. See CSecurityPrincipal.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not support business-object assignment to teams. Therefore, any solutions built by using this method are not supported by the Microsoft CRM application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

// BizMerchant proxy object
Microsoft.Crm.Platform.Proxy.BizMerchant merchant = new Microsoft.Crm.Platform.Proxy.BizMerchant ();
merchant.Credentials = System.Net.CredentialCache.DefaultCredentials;
merchant.Url = strDir + "BizMerchant.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the note to another security principal
   notesmanager.Assign(userAuth, strNoteId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class


CRMNotesManager.Create Method

The Create method creates a new note.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal Note As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  Note
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  Note
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateNote privilege to perform this action. See CUserAuth.
NoteXml
Specifies an XML string describing the note. The XML schema is described by annotation.xsd.

Return Value

Returns a String type that specifies the ID of the newly created note.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the note
   string strNotesManagerXml = "<annotation>";
   strNotesManagerXml += "<subject>A sample note</subject>";
   strNotesManagerXml += "<isdocument>1</isdocument>";
   strNotesManagerXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strNotesManagerXml += userAuth.UserId + "</ownerid>";
   strNotesManagerXml += "</annotation>";

   // Now create the note
   string strNoteId = notesmanager.Create(userAuth, strNotesManagerXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMNotesManager Class
  • Update


CRMNotesManager.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new note and then returns the XML data for the new note.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InNoteXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InNoteXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InNoteXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateNote and prvReadNote privileges to perform this action. See CUserAuth.
InNoteXml
Specifies an XML string describing the note. The XML schema is described by annotation.xsd.

Return Value

Returns a String type that specifies the XML data for the newly created note. The XML schema is described by annotation.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the note
   string strNotesManagerXml = "<annotation>";
   strNotesManagerXml += "<subject>A sample note</subject>";
   strNotesManagerXml += "<isdocument>1</isdocument>";
   strNotesManagerXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strNotesManagerXml += userAuth.UserId + "</ownerid>";
   strNotesManagerXml += "</annotation>";

   // Now create and then retrieve the note
   string strNoteXml = notesmanager.CreateAndRetrieve(userAuth, strNotesManagerXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMNotesManager Class
  • UpdateAndRetrieve


CRMNotesManager.Delete Method

The Delete method deletes the specified note.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  NoteId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  NoteId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note that is to be deleted. This ID is determined by the platform and is obtained either at the time the note is created or through a bulk retrieve.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the note
   notesmanager.Delete(userAuth, strNoteId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class


CRMNotesManager.GrantAccess Method

The GrantAccess method grants a security principal access to the specified note. This method also applies to all child objects of the note. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the note. In this case, only the lack of privileges for a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub GrantAccess(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String,
  ByVal Rights As UInt32,
  ByVal SecurityPrincipal As CSecurityPrincipal
)
[C#]
public void GrantAccess(
  CUserAuth  Caller,
  string  NoteId,
  uint  Rights,
  CSecurityPrincipal  SecurityPrincipal
);
[C++]
public: void GrantAccess(
  CUserAuth*  Caller,
  String*  NoteId,
  unsigned long  Rights,
  CSecurityPrincipal*  SecurityPrincipal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note.
Rights
Specifies the rights that are to be granted to the security principal. See ACCESSRIGHTS.
SecurityPrincipal
Specifies the team or the user being granted access. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set up the access rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Grant access for the security principal
   notesmanager.GrantAccess(userAuth, strNoteId, rights, securityPrincipal);

   // Now revoke access for the security principal
   notesmanager.RevokeAccess(userAuth, strNoteId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class


CRMNotesManager.MakePrivate Method

The MakePrivate method makes a note unavailable to anyone except the owner and the users that share the object. Only the owner of a note can make it private. (By default, all objects are public. See Remarks.)

Syntax

[Visual Basic .NET]
Public Sub MakePrivate(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String
)
[C#]
public void MakePrivate(
  CUserAuth  Caller,
  string  NoteId
);
[C++]
public: void MakePrivate(
  CUserAuth*  Caller,
  String*  NoteId
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the owner and have the prvWriteNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if an object is made private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make the note private
   notesmanager.MakePrivate(userAuth, strNoteId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class
  • MakePublic


CRMNotesManager.MakePublic Method

The MakePublic method makes a note available to all users. Only the owner of an note can make it public. By default, all objects are public. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub MakePublic(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String
)
[C#]
public void MakePublic(
  CUserAuth  Caller,
  string  NoteId
);
[C++]
public: void MakePublic(
  CUserAuth*  Caller,
  String*  NoteId
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the owner and have the prvWriteNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if an object is made private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make the note public
   notesmanager.MakePublic(userAuth,strNoteId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class
  • MakePrivate


CRMNotesManager.ModifyAccess Method

The ModifyAccess method replaces the access rights on the note for the specified security principal. This method also applies to all child objects of the note. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the note. In this case, only the lack of privileges to a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub ModifyAccess(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String,
  ByVal dwRights As UInt32,
  ByVal Principal As CSecurityPrincipal
)
[C#]
public void ModifyAccess(
  CUserAuth  Caller,
  string  NoteId,
  uint  dwRights,
  CSecurityPrincipal  Principal
);
[C++]
public: void ModifyAccess(
  CUserAuth*  Caller,
  String*  NoteId,
  unsigned long  dwRights,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvShareNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note.
dwRights
Specifies the set of rights that are to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or the user that is to be granted access. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set up the access rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Now modify access for the security principal
   notesmanager.ModifyAccess(userAuth, strNoteId, rights, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class


CRMNotesManager.RemoveBinaryData Method

The RemoveBinaryData method removes the binary attachment from the specified note.

Syntax

[Visual Basic .NET]
Public Sub RemoveBinaryData(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String
)
[C#]
public void RemoveBinaryData(
  CUserAuth  Caller,
  string  NoteId
);
[C++]
public: void RemoveBinaryData(
  CUserAuth*  Caller,
  String*  NoteId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now remove the binary data
   notesmanager.RemoveBinaryData(userAuth, strNoteId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class


CRMNotesManager.RemoveParent Method

The RemoveParent method removes the parent of an existing note but leaves the parent and the note otherwise intact.

Syntax

[Visual Basic .NET]
Public Sub RemoveParent(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String
)
[C#]
public void RemoveParent(
  CUserAuth  Caller,
  string  NoteId
);
[C++]
public: void RemoveParent(
  CUserAuth*  Caller,
  String*  NoteId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Attach the note to the account
   notesmanager.SetParent(userAuth, strNoteId, objName);

   // Remove the parent for the note
   notesmanager.RemoveParent(userAuth, strNoteId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class
  • SetParent


CRMNotesManager.Retrieve Method

The Retrieve method retrieves a note.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  NoteId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  NoteId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note that is to be retrieved.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in annotation.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data for the note. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by annotation.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Now retrieve the note
      string strNoteXml = notesmanager.Retrieve(userAuth, strNoteId, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class
  • RetrieveByObject
  • RetrieveByPrincipal
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipals
  • RetrieveSharedPrincipalsAndAccess


CRMNotesManager.RetrieveByObject Method

The RetrieveByObject method retrieves all notes that are associated with the specified object.

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Entity As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Entity,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Entity,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadNote privilege to perform this action. See CUserAuth.
Object
Specifies the object for which the notes are to be retrieved. See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that are to be retrieved. Passing "" or null returns all columns. You can find the valid column names in annotation.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of notes associated with the specified object. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<annotations> + annotation1..N + </annotations>

where the XML schema for each note is described by annotation.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Now retrieve the notes for that account
   // Passing a null string for ColumnSetXML retrieves all columns
   string strNotesXml = notesmanager.RetrieveByObject(userAuth, objName, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class
  • Retrieve


CRMNotesManager.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves all notes that are owned by the specified security principal.

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal Owner As CSecurityPrincipal,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  Owner,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  Owner,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadNote privilege to perform this action. See CUserAuth.
Principal
Specifies the security principal for which notes are to be retrieved. This is the owning user of the notes. See CSecurityPrincipal.
ColumnSetXML
Specifies an XML string describing the set of columns that are to be retrieved. Passing "" or null returns all columns. You can find the valid column in annotation.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of notes associated with the specified security principal. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<annotations> + annotation1..N + </annotations>

where the XML schema for each note is described by annotation.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>annotationid</column>";
   strColumnSetXml += "</columnset>";

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve all of the notes for the specified security principal
   string strResultXml = notesmanager.RetrieveByPrincipal(userAuth, securityPrincipal, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class
  • Retrieve


CRMNotesManager.RetrievePrincipalAccess Method

The RetrievePrincipalAccess method retrieves the access rights a specific security principal has for a specific note.

Syntax

[Visual Basic .NET]
Public Function RetrievePrincipalAccess(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String,
  ByVal Principal As CSecurityPrincipal
) As UInt32
[C#]
public uint RetrievePrincipalAccess(
  CUserAuth  Caller,
  string  NoteId,
  CSecurityPrincipal  Principal
);
[C++]
public: unsigned long RetrievePrincipalAccess(
  CUserAuth*  Caller,
  String*  NoteId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note.
Principal
Specifies the security principal. See CSecurityPrincipal.

Return Value

Returns a UInt32 type that specifies the rights the security principal has for the note. See ACCESSRIGHTS.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Now retrieve principal access for the note
   uint uintAccess = notesmanager.RetrievePrincipalAccess(userAuth, strNoteId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class
  • Retrieve


CRMNotesManager.RetrieveSharedPrincipals Method

The RetrieveSharedPrincipals method retrieves all users and teams who have the specified access to the note.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipals(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String,
  ByVal Rights As UInt32
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipals(
  CUserAuth  Caller,
  string  NoteId,
  uint  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipals(
  CUserAuth*  Caller,
  String*  NoteId,
  unsigned long  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note.
Rights
Specifies the rights for the note. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies an array of security principals associated with the specified note. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the access rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Retrieve the shared principals
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;
   securityPrincipals = notesmanager.RetrieveSharedPrincipals(userAuth, strNoteId, rights);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class
  • Retrieve
  • RetrieveSharedPrincipalsAndAccess


CRMNotesManager.RetrieveSharedPrincipalsAndAccess Method

The RetrieveSharedPrincipalsAndAccess method retrieves all of the security principals (users or teams) that have access to a note and their access rights for that note.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipalsAndAccess(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String,
  ByRef Rights As UInt32()
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipalsAndAccess(
  CUserAuth  Caller,
  string  NoteId,
  out uint[]  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipalsAndAccess(
  CUserAuth*  Caller,
  String*  NoteId,
  unsigned long*  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note.
Rights
[out] Specifies an array of rights for the principals. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies an array of principals associated with the specified note. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set up the access rights
   uint[] rights;

   // Retrieve the shared principals and access
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;
   securityPrincipals = notesmanager.RetrieveSharedPrincipalsAndAccess(userAuth, strNoteId, out rights);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class
  • Retrieve
  • RetrieveSharedPrincipals


CRMNotesManager.RevokeAccess Method

The RevokeAccess method revokes access rights to the note for the specified security principal. This method also applies to all child objects of the note. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the note. In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

Syntax

[Visual Basic .NET]
Public Sub RevokeAccess(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String,
  ByVal SecurityPrincipal As CSecurityPrincipal
)
[C#]
public void RevokeAccess(
  CUserAuth  Caller,
  string  NoteId,
  CSecurityPrincipal  SecurityPrincipal
);
[C++]
public: void RevokeAccess(
  CUserAuth*  Caller,
  String*  NoteId,
  CSecurityPrincipal*  SecurityPrincipal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note.
SecurityPrincipal
Specifies the security principal (user or team) whose access is being revoked. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set up the access rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Grant access for the security principal
   notesmanager.GrantAccess(userAuth, strNoteId, rights, securityPrincipal);

   // Now revoke access for the security principal
   notesmanager.RevokeAccess(userAuth, strNoteId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class


CRMNotesManager.SetParent Method

The SetParent method sets the parent for an existing note.

Syntax

[Visual Basic .NET]
Public Sub SetParent(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String,
  ByVal Entity As CObjectName
)
[C#]
public void SetParent(
  CUserAuth  Caller,
  string  NoteId,
  CObjectName  Entity
);
[C++]
public: void SetParent(
  CUserAuth*  Caller,
  String*  NoteId,
  CObjectName*  Entity
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note.
Entity
Specifies the new parent object for the note. See CObjectName.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Now attach the note to the account
   notesmanager.SetParent(userAuth, strNoteId, objName);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMNotesManager Class
  • RemoveParent


CRMNotesManager.Update Method

The Update method updates an existing note.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String,
  ByVal Note As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  NoteId,
  string  Note
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  NoteId,
  String*  Note
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteNote privilege to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note that is to be updated.
Note
Specifies an XML string describing the note. The XML schema is described by annotation.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   //Set up the XML string to update the note
   string strNotesManagerXml = "<annotation>";
   strNotesManagerXml += "<subject>An updated sample note</subject>";
   strNotesManagerXml += "<isdocument>0</isdocument>";
   strNotesManagerXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strNotesManagerXml += userAuth.UserId + "</ownerid>";
   strNotesManagerXml += "</annotation>";

   // Now update the note
   notesmanager.Update(userAuth, strNoteId, strNotesManagerXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMNotesManager Class
  • UpdateAndRetrieve


CRMNotesManager.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an existing note and then returns the XML data for the note.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal NoteId As String,
  ByVal InNoteXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  NoteId,
  string  InNoteXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  NoteId,
  String*  InNoteXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvWriteNote and prvReadNote privileges to perform this action. See CUserAuth.
NoteId
Specifies the ID of the note that is to be updated.
InNoteXml
Specifies an XML string describing the note. The XML schema is described by annotation.xsd.

Return Value

Returns a String type that specifies the XML data for the note. The XML schema is described by annotation.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMNotesManager proxy object
Microsoft.Crm.Platform.Proxy.CRMNotesManager  notesmanager = new Microsoft.Crm.Platform.Proxy.CRMNotesManager();
notesmanager.Credentials = System.Net.CredentialCache.DefaultCredentials;
notesmanager.Url = strDir + "CRMNotesManager.srf";

string strErrorMsg;
string strNoteId = "{09CBE06F-40DB-4C9D-9CAF-9B7F27294793}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the note
   string strNotesManagerXml = "<annotation>";
   strNotesManagerXml += "<subject>An updated sample note</subject>";
   strNotesManagerXml += "<isdocument>0</isdocument>";
   strNotesManagerXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strNotesManagerXml += userAuth.UserId + "</ownerid>";
   strNotesManagerXml += "</annotation>";

   // Now update and then retrieve the note
   string strNoteXml = notesmanager.UpdateAndRetrieve(userAuth, strNoteId, strNotesManagerXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMNotesManager Class
  • Update


CRMOpportunity Class

The CRMOpportunity class contains methods that you can use to manage opportunities.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMOpportunity
[Visual Basic .NET]
Public Class CRMOpportunity
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMOpportunity : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMOpportunity: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMOpportunity class exposes the following methods.

Method | Description
Assign | Assigns an opportunity to a new security principal (user or team).
BulkRetrieve | Retrieves multiple opportunities.
CalculateActualValue | Calculates the actual value of the opportunity.
Create | Creates a new opportunity.
CreateAndRetrieve | Creates a new opportunity and then retrieves it.
Delete | Deletes an opportunity.
GrantAccess | Grants a security principal access to an opportunity.
Lose | Sets the state of an opportunity to Lost.
MakePrivate | Makes an opportunity private.
MakePublic | Makes an opportunity public.
ModifyAccess | Replaces the access rights on the opportunity for the specified security principal.
Open | Sets the state of the opportunity to Open.
RemoveAssociation | Removes the association between an object (account, competitor, or contact) and an opportunity.
Retrieve | Retrieves an existing opportunity.
RetrieveByObject | Retrieves all opportunities that are associated with an object (account or contact).
RetrieveByPrincipal | Retrieves all of the opportunities that are owned by the specified security principal.
RetrievePrincipalAccess | Retrieves the access a security principal has for the specified opportunity.
RetrieveSharedPrincipals | Retrieves all of the security principals (users or teams) that have access to an opportunity.
RetrieveSharedPrincipalsAndAccess | Retrieves all of the security principals (users or teams) that have access to an opportunity and their access rights for that opportunity.
RetrieveUntouchedOpportunities | [Not supported in this release.]
RevokeAccess | Revokes a the access a security principal has for an opportunity.
SetAssociation | Creates an association between an object (account, competitor, or contact) and an opportunity.
Update | Updates an existing opportunity.
UpdateAndRetrieve | Updates an existing opportunity and then retrieves it.
ValidForClose | Checks whether it is valid to close the opportunity.
Win | Sets the state of an opportunity to Won.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMOpportunity.Assign Method

The Assign method assigns the opportunity to a security principal (user or team). (See Remarks.) This method also applies to the parent object and associated objects that have the same owner as the parent object. Therefore when you assign the parent object to a new owner, only the associated objects that have the same owner as the parent object are assigned. In addition, when an object is assigned to a new owner, it is shared with the previous owner with full rights. Either the new owner or the previous owner can remove the relationship or lower the level of privileges the previous owner had on the object.

Syntax

[Visual Basic .NET]
Public Sub Assign(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal Assignee As CSecurityPrincipal
)
[C#]
public void Assign(
  CUserAuth  Caller,
  string  OpportunityId,
  CSecurityPrincipal  Assignee
);
[C++]
public: void Assign(
  CUserAuth*  Caller,
  String*  OpportunityId,
  CSecurityPrincipal*  Assignee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity that is to be assigned.
Assignee
Specifies the security principal (user or team) to whom the opportunity is to be assigned. See CSecurityPrincipal.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not support business-object assignment to teams. Therefore, any solutions built by using this method are not supported by the Microsoft CRM application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the opportunity to another security principal
   opportunity.Assign(userAuth, strOpportunityId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class


CRMOpportunity.BulkRetrieve Method

The BulkRetrieve method retrieves multiple opportunities by ID.

Syntax

[Visual Basic .NET]
Public Function BulkRetrieve(
  ByVal Caller As CUserAuth,
  ByVal Ids As String(),
  ByVal ColumnSet As String
) As String
[C#]
public string BulkRetrieve(
  CUserAuth  Caller,
  string[]  Ids,
  string  ColumnSet
);
[C++]
public: String* BulkRetrieve(
  CUserAuth*  Caller,
  String*  Ids __gc[],
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
Count
Specifies the number of elements in the Ids array.
Ids
Specifies the array of IDs for the opportunities that are to be retrieved.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in opportunity.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested opportunity information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<opportunities> + opportunity1..N + </opportunities>

where the XML schema is described by opportunity.xsd.

Remarks

The array of IDs that are passed in must not have any empty elements.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
string strOpportunityId2 = "{72D46F0C-3855-4CA2-96E9-498E9BA08665}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string[] opporunities = new string[2];
   opporunities[0] = strOpportunityId;
   opporunities[1] = strOpportunityId2;

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>opportunityid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Do a bulk retrieve
   string strXmlOpportunities = opportunity.BulkRetrieve(userAuth, opportunites, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class


CRMOpportunity.CalculateActualValue Method

The CalculateActualValue method calculates the actual value of the opportunity.

Note In Microsoft CRM Version 1.2, this method calculates only those quotes with the state of 'Won'. Microsoft CRM Version 1.0 included all quotes, regardless of their state.

Syntax

[Visual Basic .NET]
Public Function CalculateActualValue(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal Object As ObjectType
) As String
[C#]
public string CalculateActualValue(
  CUserAuth  Caller,
  string  OpportunityId,
  ObjectType  Object
);
[C++]
public: String* CalculateActualValue(
  CUserAuth*  Caller,
  String*  OpportunityId,
  ObjectType  Object
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
ObjectType
Specifies the type of the object (quote). See ObjectType.

Return Value

Returns a String type that specifies the actual value of the opportunity.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strOpportunityId = "{C0389BC8-2715-49DD-A95C-58E5215CE5A7}";

   // Now calculate the actual value for the opportunity
   string strValue = opportunity.CalculateActualValue(userAuth, strOpportunityId, Microsoft.Crm.Platform.Proxy.ObjectType.otQuote);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class


CRMOpportunity.Create Method

The Create method creates a new opportunity. A parent account or contact must be provided for a new opportunity.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal OpportunityXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  OpportunityXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  OpportunityXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateOpportunity privilege to perform this action. See CUserAuth.
OpportunityXML
Specifies an XML string representing the opportunity. The XML schema is described by opportunity.xsd.

Return Value

Returns a String type that specifies the ID of the newly created opportunity.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the opportunity
   string strOpportunityXml = "<opportunity>";
   strOpportunityXml += "<name>My Opportunity</name>";
   strOpportunityXml += "<accountid>" + strAccountId + "</accountid>";
   strOpportunityXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strOpportunityXml += userAuth.UserId + "</ownerid>";
   strOpportunityXml += "</opportunity>";

   // Create the opportunity
   string strOpportunityId = opportunity.Create(userAuth, strOpportunityXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMOpportunity Class
  • Update


CRMOpportunity.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new opportunity and then retrieves it. A parent account or contact must be provided for a new opportunity.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InOpportunityXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InOpportunityXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InOpportunityXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateOpportunity and prvReadOpportunity privileges to perform this action. See CUserAuth.
InOpportunityXML
Specifies an XML string representing the opportunity. The XML schema is described by opportunity.xsd.

Return Value

Returns a String type that specifies the XML data containing the requested opportunity information. The XML schema is described by opportunity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the opportunity
   string strOpportunityXml = "<opportunity>";
   strOpportunityXml += "<name>opportunity 1</name>";
   strOpportunityXml += "<accountid>" + strAccountId + "</accountid>";
   strOpportunityXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   strOpportunityXml += userAuth.UserId + "</ownerid>";
   strOpportunityXml += "</opportunity>";

   string strResultsXml = opportunity.CreateAndRetrieve(userAuth, strOpportunityXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMOpportunity Class
  • UpdateAndRetrieve


CRMOpportunity.Delete Method

The Delete method deletes an opportunity.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  OpportunityId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  OpportunityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the opportunity
   opportunity.Delete(userAuth, strOpportunityId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class


CRMOpportunity.GrantAccess Method

The GrantAccess method grants a security principal access to the specified opportunity. This method also applies to all child objects of the opportunity. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the opportunity. In this case, only the lack of privileges for a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub GrantAccess(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void GrantAccess(
  CUserAuth  Caller,
  string  OpportunityId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void GrantAccess(
  CUserAuth*  Caller,
  String*  OpportunityId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
Rights
Specifies the rights that are to be granted to the principal for the opportunity. See ACCESSRIGHTS.
Grantee
Specifies the security principal (user or team) for whom access is to be granted. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Grant access for the security principal
   opportunity.GrantAccess(userAuth, strOpportunityId, rights, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class


CRMOpportunity.Lose Method

The Lose method sets the state of an opportunity to Lost.

Syntax

[Visual Basic .NET]
Public Sub Lose(
  ByVal Caller As CUserAuth,
  ByVal ActivityXML As String,
  ByVal PartiesXML As String,
  ByVal Status As Integer
)
[C#]
public void Lose(
  CUserAuth  Caller,
  string  ActivityXML,
  string  PartiesXML,
  int  Status
);
[C++]
public: void Lose(
  CUserAuth*  Caller,
  String*  ActivityXML,
  String*  PartiesXML,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteOpportunity privilege to perform this action. See CUserAuth.
ActivityXML
Specifies an XML string representing the activity. The XML schema is described by activity.xsd.
PartiesXML
Specifies an XML string representing the parties. The XML schema is described by activityparty.xsd.
Status
Specifies the status of the opportunity. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strOpportunityId = "{32BF9CB0-DA58-4AAE-861B-CB499F44FC74}";

   // Set up the XML string for the activity
   string activityXML = "<activity>";
       activityXML += "<activitytypecode>" +  Microsoft.Crm.Platform.Types.ObjectType.otOpportunityCloseActivity.ToString() + "</activitytypecode>";
       activityXML += "<objectid>" + strOpportunityId + "</objectid>";
       activityXML += "<objecttypecode>" +  Microsoft.Crm.Platform.Types.ObjectType.otOpportunity.ToString()  + "</objecttypecode>";
       activityXML += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
       activityXML += userAuth.UserId + "</ownerid></activity>";

   opportunity.Lose(userAuth, activityXML, "", -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class


CRMOpportunity.MakePrivate Method

The MakePrivate method makes the opportunity unavailable to anyone except the owner and the users that share the object. Only the owner of an opportunity can make it private. By default, all objects are public. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub MakePrivate(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String
)
[C#]
public void MakePrivate(
  CUserAuth  Caller,
  string  OpportunityId
);
[C++]
public: void MakePrivate(
  CUserAuth*  Caller,
  String*  OpportunityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the owner and have the prvWriteOpportunity privilege for the opportunity to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity that is to be made private.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if an object is made private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make the opportunity private
   opportunity.MakePrivate(userAuth, strOpportunityId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class
  • MakePublic


CRMOpportunity.MakePublic Method

The MakePublic method makes an opportunity available to all users. Only the owner of an opportunity can make it public. By default, all objects are public. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub MakePublic(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String
)
[C#]
public void MakePublic(
  CUserAuth  Caller,
  string  OpportunityId
);
[C++]
public: void MakePublic(
  CUserAuth*  Caller,
  String*  OpportunityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the owner and have the prvWriteOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity that is to be made public.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not provide an interface for making an object private. However, if an object is made private by using a third-party solution, the application recognizes this setting.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Make the opportunity public
   opportunity.MakePublic(userAuth, strOpportunityId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class
  • MakePrivate


CRMOpportunity.ModifyAccess Method

The ModifyAccess method replaces the access rights on the opportunity for the specified security principal. This method also applies to all child objects of the opportunity. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the opportunity. In this case, only the lack of privileges to a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub ModifyAccess(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal Rights As UInt32,
  ByVal Grantee As CSecurityPrincipal
)
[C#]
public void ModifyAccess(
  CUserAuth  Caller,
  string  OpportunityId,
  uint  Rights,
  CSecurityPrincipal  Grantee
);
[C++]
public: void ModifyAccess(
  CUserAuth*  Caller,
  String*  OpportunityId,
  unsigned long  Rights,
  CSecurityPrincipal*  Grantee
);

Parameters

Caller
Specifies the identity of the caller. The caller must be the object owner and have the prvShareOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
Rights
Specifies the set of rights that are to be granted. See ACCESSRIGHTS.
Grantee
Specifies the team or user for whom access is to be granted. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Grant access for the security principal
   opportunity.ModifyAccess(userAuth, strOpportunityId, rights, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class


CRMOpportunity.Open Method

The Open method sets the state of an opportunity to Open. The state of the opportunity must be Closed for this method to be successful.

Syntax

[Visual Basic .NET]
Public Sub Open(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal Status As Integer
)
[C#]
public void Open(
  CUserAuth  Caller,
  string  OpportunityId,
  int  Status
);
[C++]
public: void Open(
  CUserAuth*  Caller,
  String*  OpportunityId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity that is to be opened.
Status
Specifies the status of the opportunity. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strOpportunityId = "{0A9DB802-CB58-44E7-B8E2-460D3761EB39}";

   // Set up the XML string for the activity
   string activityXML = "<activity>";
   activityXML += "<activitytypecode>" +  Microsoft.Crm.Platform.Types.ObjectType.otOpportunityCloseActivity.ToString() + "</activitytypecode>";
   activityXML += "<objectid>" + strOpportunityId + "</objectid>";
   activityXML += "<objecttypecode>" +  Microsoft.Crm.Platform.Types.ObjectType.otOpportunity.ToString() + "</objecttypecode>";
   activityXML += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   activityXML += userAuth.UserId + "</ownerid></activity>";

   // The opportunity must be "won" or "lost" before calling this method
   opportunity.Win(userAuth, activityXML, "", -1);

   // Now open the opportunity
   opportunity.Open(userAuth, strOpportunityId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class


CRMOpportunity.RemoveAssociation Method

The RemoveAssociation method removes the association between an object (account, competitor, or contact) and an opportunity.

Syntax

[Visual Basic .NET]
Public Sub RemoveAssociation(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal Object As CObjectName
)
[C#]
public void RemoveAssociation(
  CUserAuth  Caller,
  string  OpportunityId,
  CObjectName  Object
);
[C++]
public: void RemoveAssociation(
  CUserAuth*  Caller,
  String*  OpportunityId,
  CObjectName*  Object
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendOpportunity and either prvAppendToAccount or prvAppendToContact privileges to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
Object
Specifies the object (account, contact or lead) that is to be disassociated from the opportunity. See CObjectName.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create an object name
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Set the association with the account object
   opportunity.SetAssociation(userAuth, strOpportunityId, objName);

   // Now remove the association between the opportunity and the account
   opportunity.RemoveAssociation(userAuth, strOpportunityId, objName);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class
  • SetAssociation


CRMOpportunity.Retrieve Method

The Retrieve method retrieves an existing opportunity.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  OpportunityId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  OpportunityId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity that is to be retrieved.
ColumnSetXML
Specifies an XML striing describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in opportunity.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested opportunity information. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by opportunity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>opportunityid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Now retrieve the opportunity
   string strNewOpportunity = opportunity.Retrieve(userAuth, strOpportunityId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class
  • RetrieveByObject
  • RetrieveByPrincipal
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipals
  • RetrieveSharedPrincipalsAndAccess


CRMOpportunity.RetrieveByObject Method

The RetrieveByObject method retrieves all opportunities that are associated with an object (account or contact).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
Object
Specifies the object (account or contact) for which associated opportunities are to be retrieved. See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in opportunity.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of opportunities associated with the specified object (account or contact). The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<opportunities> + opportunity1..N + </opportunities>

where the XML schema for each opportunity is described by opportunity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>opportunityid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Create an object name
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Retrieve the opportunities that are associated with the account
   string strResultsXml = opportunity.RetrieveByObject(userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class
  • Retrieve


CRMOpportunity.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves all of the opportunities that are owned by the specified security principal.

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal Principal As CSecurityPrincipal,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  Principal,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  Principal,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
Principal
Specifies the security principal for which opportunities are to be retrieved. See CSecurityPrincipal.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in opportunity.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of opportunities associated with the specified security principal. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<opportunities> + opportunity1..N + </opportunities>

where the XML schema for each opportunity is described by opportunity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>opportunityid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Create a new security principal from the user
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve the opportunities that are owned by the security principal
   string strResultsXml = opportunity.RetrieveByPrincipal(userAuth, securityPrincipal, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class
  • Retrieve


CRMOpportunity.RetrievePrincipalAccess Method

The RetrievePrincipalAccess method retrieves the access a specific security principal has for a specific opportunity.

Syntax

[Visual Basic .NET]
Public Function RetrievePrincipalAccess(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal Principal As CSecurityPrincipal
) As UInt32
[C#]
public uint RetrievePrincipalAccess(
  CUserAuth  Caller,
  string  OpportunityId,
  CSecurityPrincipal  Principal
);
[C++]
public: unsigned long RetrievePrincipalAccess(
  CUserAuth*  Caller,
  String*  OpportunityId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
Principal
Specifies security principal (user or team). See CSecurityPrincipal.

Return Value

Returns a UInt32 type that specifies the rights the principal has for the opportunity. See ACCESSRIGHTS.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

// CRMAccount proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = strDir + "CRMAccount.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve the access rights for the security principal
   uint uintAccessVal = opportunity.RetrievePrincipalAccess(userAuth, strOpportunityId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class
  • Retrieve


CRMOpportunity.RetrieveSharedPrincipals Method

The RetrieveSharedPrincipals method retrieves all of the security principals (users or teams) that have access to an opportunity.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipals(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal Rights As UInt32
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipals(
  CUserAuth  Caller,
  string  OpportunityId,
  uint  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipals(
  CUserAuth*  Caller,
  String*  OpportunityId,
  unsigned long  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
Rights
Specifies the rights to find. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of security principals associated with the specified opportunity. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the set of security principals who share this opportunity
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;
   securityPrincipals = opportunity.RetrieveSharedPrincipals(userAuth, strOpportunityId, Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class
  • Retrieve
  • RetrieveSharedPrincipalsAndAccess


CRMOpportunity.RetrieveSharedPrincipalsAndAccess Method

The RetrieveSharedPrincipalsAndAccess method retrieves all of the security principals (users or teams) that have access to an opportunity and their access rights for that opportunity.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipalsAndAccess(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByRef Rights As UInt32()
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipalsAndAccess(
  CUserAuth  Caller,
  string  OpportunityId,
  out uint[]  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipalsAndAccess(
  CUserAuth*  Caller,
  String*  OpportunityId,
  unsigned long*  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
Rights
[out] Specifies the array of rights that are found. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of security principals associated with the specified opportunity. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   uint[] rights;

   // Retrieve shared principals and their access rights
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;
   securityPrincipals = opportunity.RetrieveSharedPrincipalsAndAccess(userAuth, strOpportunityId, out rights);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class
  • Retrieve
  • RetrieveSharedPrincipals


CRMOpportunity.RevokeAccess Method

The RevokeAccess method revokes access rights to the opportunity for the specified security principal. This method also applies to all child objects of the opportunity. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the opportunity. In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

Syntax

[Visual Basic .NET]
Public Sub RevokeAccess(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal Revokee As CSecurityPrincipal
)
[C#]
public void RevokeAccess(
  CUserAuth  Caller,
  string  OpportunityId,
  CSecurityPrincipal  Revokee
);
[C++]
public: void RevokeAccess(
  CUserAuth*  Caller,
  String*  OpportunityId,
  CSecurityPrincipal*  Revokee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
Revokee
Specifies the security principal for whom access is to be revoked. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a new security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ;

   // Grant access for the security principal
   opportunity.GrantAccess(userAuth, strOpportunityId, rights, securityPrincipal);

   // Now revoke access for the security principal
   opportunity.RevokeAccess(userAuth, strOpportunityId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class


CRMOpportunity.SetAssociation Method

The SetAssociation method creates an association between an object (account, competitor, or contact) and an opportunity.

Syntax

[Visual Basic .NET]
Public Sub SetAssociation(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal Object As CObjectName
)
[C#]
public void SetAssociation(
  CUserAuth  Caller,
  string  OpportunityId,
  CObjectName  Object
);
[C++]
public: void SetAssociation(
  CUserAuth*  Caller,
  String*  OpportunityId,
  CObjectName*  Object
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendOpportunity and either prvAppendToAccount or prvAppendToContact privileges to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
Object
Specifies the object (account, contact, or lead) that is to be associated with the opportunity. See CObjectName.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create an object name
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Set the association with the account object
   opportunity.SetAssociation(userAuth, strOpportunityId, objName);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class
  • RemoveAssociation


CRMOpportunity.Update Method

The Update method updates an opportunity.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal OpportunityXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  OpportunityId,
  string  OpportunityXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  OpportunityId,
  String*  OpportunityXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity that is to be updated.
OpportunityXML
Specifies an XML string representing the opportunity. The XML schema is described by opportunity.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the opportunity
   strOpportunityXml = "<opportunity><name>New Opportunity Name</name></opportunity>";

   // Now update the opportunity
   opportunity.Update(userAuth, strOpportunityId, strOpportunityXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMOpportunity Class
  • UpdateAndRetrieve


CRMOpportunity.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an opportunity and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal InOpportunityXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  OpportunityId,
  string  InOpportunityXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  OpportunityId,
  String*  InOpportunityXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteOpportunity and prvReadOpportunity privileges to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity that is to be updated.
InOpportunityXML
Specifies an XML string representing the opportunity. The XML schema is described by opportunity.xsd.

Return Value

Returns a String type that specifies the XML data containing the requested opportunity information. The XML schema is described by opportunity.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up XML string to update the opportunity
   strOpportunityXml = "<opportunity><name>New Opportunity Name</name></opportunity>";

   // Now update and retrieve the opportunity
   string strResultsXml = opportunity.UpdateAndRetrieve(userAuth, strOpportunityId, strOpportunityXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMOpportunity Class
  • Update


CRMOpportunity.ValidForClose Method

The ValidForClose method checks whether this opportunity is valid for close.

Syntax

[Visual Basic .NET]
Public Function ValidForClose(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByRef OpenQuoteCount As Integer
) As Integer
[C#]
public int ValidForClose(
  CUserAuth  Caller,
  string  OpportunityId,
  out int  OpenQuoteCount
);
[C++]
public: long ValidForClose(
  CUserAuth*  Caller,
  String*  OpportunityId,
  long*  OpenQuoteCount
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
OpenQuoteCount
[out] Specifies the number of draft or active quotes for this opportunity.

Return Value

Returns an Int32 type that specifies true if the opportunity can be closed.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   int qcount;

   // Check whether the opportunity is valid for close
   int valid = opportunity.ValidForClose(userAuth, strOpportunityId, out qcount);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class


CRMOpportunity.Win Method

The Win method sets the state of an opportunity to Won.

Syntax

[Visual Basic .NET]
Public Sub Win(
  ByVal Caller As CUserAuth,
  ByVal ActivityXML As String,
  ByVal PartiesXML As String,
  ByVal Status As Integer
)
[C#]
public void Win(
  CUserAuth  Caller,
  string  ActivityXML,
  string  PartiesXML,
  int  Status
);
[C++]
public: void Win(
  CUserAuth*  Caller,
  String*  ActivityXML,
  String*  PartiesXML,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteOpportunity privilege to perform this action. See CUserAuth.
ActivityXML
Specifies an XML string representing the activity. The XML schema is described by activity.xsd.
PartiesXML
Specifies an XML string representing the parties. The XML schema is described by activityparty.xsd.
Status
Specifies the status of the opportunity. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = " myservername ";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunity proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strOpportunityId = "{F1F43717-C487-4289-806E-FE36202223F9}";

   // Set up the XML string for the activity
   string activityXML = "<activity>";
   activityXML += "<activitytypecode>" +  Microsoft.Crm.Platform.Types.ObjectType.otOpportunityCloseActivity.ToString() + "</activitytypecode>";
   activityXML += "<objectid>" + strOpportunityId + "</objectid>";
   activityXML += "<objecttypecode>" +  Microsoft.Crm.Platform.Types.ObjectType.otOpportunity.ToString() + "</objecttypecode>";
   activityXML += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   activityXML += userAuth.UserId + "</ownerid></activity>";

   opportunity.Win(userAuth, activityXML, "", -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunity Class


CRMOpportunityProduct Class

The CRMOpportunityProduct class contains methods that you can use to manage opportunity products.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMOpportunityProduct
[Visual Basic .NET]
Public Class CRMOpportunityProduct
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMOpportunityProduct : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMOpportunityProduct: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMOpportunityProduct class exposes the following methods.

Method | Description
Create | Creates an opportunity product.
CreateAndRetrieve | Creates an opportunity product and then retrieves it.
Delete | Deletes an opportunity product.
GetQuantityDecimal | Retrieves the quantity decimal value for a product.
Retrieve | Retrieves an opportunity product.
RetrieveByObject | Retrieves all opportunity products that are associated with an object (opportunity).
Update | Updates an opportunity product.
UpdateAndRetrieve | Updates an opportunity product and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMOpportunityProduct.Create Method

The Create method creates an opportunity product.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal OpportunityProductXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  OpportunityProductXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  OpportunityProductXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvReadProduct and prvAppendToOpportunity privileges to perform this action. See CUserAuth.
OpportunityProductXml
Specifies an XML string representing an opportunity product. The XML schema is described by opportunityproduct.xsd.

Return Value

Returns a String type that specifies the ID of the new opportunity product.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunityProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct  opportunityproduct = new Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct();
opportunityproduct.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunityproduct.Url = strDir + "CRMOpportunityProduct.srf";

string strErrorMsg;
string strOpportunityId = "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the opportunity
   string strOpportunityXml = "<opportunityproduct>";
   strOpportunityXml += "<productid>" +  strProductId + "</productid>";
   strOpportunityXml += "<opportunityid>" + strOpportunityId + "</opportunityid>";
   strOpportunityXml += "<quantity>12</quantity></opportunityproduct>";

   // Create the opportunity
   string strOpportunityId = opportunityproduct.Create (userAuth, strOpportunityXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMOpportunityProduct Class
  • Update


CRMOpportunityProduct.CreateAndRetrieve Method

The CreateAndRetrieve method creates an opportunity product and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InOpportunityProductXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InOpportunityProductXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InOpportunityProductXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvReadProduct, prvAppendToOpportunity, and prvReadOpportunity privileges to perform this action. privileges to perform this action. See CUserAuth.
InOpportunityProductXml
Specifies an XML string representing an opportunity product. The XML schema is described by opportunityproduct.xsd.

Return Value

Returns a String type that specifies the XML data representing the new opportunity product. The XML schema is described by opportunityproduct.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunityProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct  opportunityproduct = new Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct();
opportunityproduct.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunityproduct.Url = strDir + "CRMOpportunityProduct.srf";

string strErrorMsg;
string strOpportunityId = "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the opportunity
   string strOpportunityXml = "<opportunityproduct>";
   strOpportunityXml += "<productid>" +  strProductId + "</productid>";
   strOpportunityXml += "<opportunityid>" + strOpportunityId + "</opportunityid>";
   strOpportunityXml += "<quantity>12</quantity></opportunityproduct>";

   // Create the opportunity
   string strResultXml = opportunityproduct.CreateAndRetrieve (userAuth, strOpportunityXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMOpportunityProduct Class
  • UpdateAndRetrieve


CRMOpportunityProduct.Delete Method

The Delete method deletes an opportunity product object.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal OpportunityProductId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  OpportunityProductId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  OpportunityProductId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvAppendToOpportunity and prvReadProduct privileges to perform this action. See CUserAuth.
OpportunityProductId
Specifies the ID of the opportunity product that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunityProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct  opportunityproduct = new Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct();
opportunityproduct.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunityproduct.Url = strDir + "CRMOpportunityProduct.srf";

string strErrorMsg;
string strOpportunityProductId = "{69869894-638F-J892-A692-E2BC7ED23557}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the opportunity product
   opportunityproduct.Delete(userAuth, strOpportunityProductId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunityProduct Class


CRMOpportunityProduct.GetQuantityDecimal Method

The GetQuantityDecimal method retrieves the quantity decimal value for a product.

Syntax

[Visual Basic .NET]
Public Function GetQuantityDecimal(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal strProductId As String,
  ByVal strUoMId As String
) As Integer
[C#]
public int GetQuantityDecimal(
  CUserAuth  Caller,
  string  OpportunityId,
  string  strProductId,
  string  strUoMId
);
[C++]
public: long GetQuantityDecimal(
  CUserAuth*  Caller,
  String*  OpportunityId,
  String*  strProductId,
  String*  strUoMId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
ProductId
Specifies the ID of the product.
UoMId
Specifies the ID of the unit of measure.

Return Value

Returns an Int32 type that is the quantity decimal value for the specified product.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunityProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct  opportunityproduct = new Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct();
opportunityproduct.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunityproduct.Url = strDir + "CRMOpportunityProduct.srf";

string strErrorMsg;
string strOpportunityProductId = "{69869894-638F-J892-A692-E2BC7ED23557}";
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B
string strUoMId = "{E0B38CBE-91BB-4863-8F4F-76785CE705D2}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Get the quantity
   opportunityproduct.GetQuantityDecimal (userAuth, strOpportunityProductId, strProductId, strUoMId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunityProduct Class


CRMOpportunityProduct.Retrieve Method

The Retrieve method retrieves an opportunity product.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal OpportunityProductId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  OpportunityProductId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  OpportunityProductId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvReadOpportunity and prvReadProduct privileges to perform this action. See CUserAuth.
OpportunityProductId
Specifies the ID of the opportunity product that is to be retrieved.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in opportunityproduct.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the opportunity product. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by opportunityproduct.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunityProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunity opportunity = new Microsoft.Crm.Platform.Proxy.CRMOpportunity();
opportunity.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunity.Url = strDir + "CRMOpportunity.srf";

string strErrorMsg;
string strOpportunityProductId = "{69869894-638F-J892-A692-E2BC7ED23557}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>priceperunit</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the opportunity product
   string strResultsXml = opportunityproduct.Retrieve (userAuth, strOpportunityProductId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunityProduct Class
  • RetrieveByObject


CRMOpportunityProduct.RetrieveByObject Method

The RetrieveByObject method retrieves all opportunity products that are associated with an object (opportunity).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOpportunity privilege to perform this action. See CUserAuth.
Object
Specifies the object (opportunity) to find. See CObjectName.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in opportunityproduct.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of opportunity products associated with the specified object. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<opportunityproducts> + opportunityproduct1..N + </opportunityproducts>

where the XML schema for each opportunity product is described by opportunityproduct.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunityProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct  opportunityproduct = new Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct();
opportunityproduct.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunityproduct.Url = strDir + "CRMOpportunityProduct.srf";

string strErrorMsg;
string strOpportunityId= "{3BDFF384-0E6B-42F8-924E-61A40514E6F6}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>priceperunit</column>";
   strColumnSetXml += "</columnset>";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strOpportunityId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otOpportunityProduct;

   // Retrieve the opportunity products for the opportunity
   string strResultsXml = opportunityproduct.RetrieveByObject(userAuth objName, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMOpportunityProduct Class
  • Retrieve


CRMOpportunityProduct.Update Method

The Update method updates an opportunity product object.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal OpportunityProductId As String,
  ByVal OpportunityProductXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  OpportunityProductId,
  string  OpportunityProductXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  OpportunityProductId,
  String*  OpportunityProductXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvAppendToOpportunity and prvReadProduct privileges to perform this action. See CUserAuth.
OpportunityProductId
Specifies the ID of the opportunity product that is to be updated.
OpportunityProductXml
Specifies an XML string representing an opportunity product. The XML schema is described by opportunityproduct.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunityProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct  opportunityproduct = new Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct();
opportunityproduct.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunityproduct.Url = strDir + "CRMOpportunityProduct.srf";

string strErrorMsg;
string strOpportunityProductId="{69869894-638F-J892-A692-E2BC7ED23557}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the opportunity
   string strOpportunityXml = "<opportunityproduct>";
   strOpportunityXml += "<description>My new description</description>";
   strOpportunityXml += "<quantity>12</quantity></opportunityproduct>";

   // Update the opportunity product
   opportunityproduct.Update (userAuth, strOpportunityProductId, strOpportunityXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMOpportunityProduct Class
  • UpdateAndRetrieve


CRMOpportunityProduct.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates an opportunity product and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal OpportunityProductId As String,
  ByVal InOpportunityProductXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  OpportunityProductId,
  string  InOpportunityProductXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  OpportunityProductId,
  String*  InOpportunityProductXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvAppendToOpportunity, prvReadProduct, and prvReadOpportunity privileges to perform this action. See CUserAuth.
OpportunityProductId
Specifies the ID of the opportunity product that is to be updated.
InOpportunityProductXml
Specifies an XML string representing an opportunity product. The XML schema is described by opportunityproduct.xsd.

Return Value

Returns a String type that specifies the XML data representing the opportunity product. The XML schema is described by opportunityproduct.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMOpportunityProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct  opportunityproduct = new Microsoft.Crm.Platform.Proxy.CRMOpportunityProduct();
opportunityproduct.Credentials = System.Net.CredentialCache.DefaultCredentials;
opportunityproduct.Url = strDir + "CRMOpportunityProduct.srf";

string strErrorMsg;
string strOpportunityProductId = "{69869894-638F-J892-A692-E2BC7ED23557}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the opportunity
   string strOpportunityXml = "<opportunityproduct>";
   strOpportunityXml += "<descriptionMy new description</description>";
   strOpportunityXml += "<quantity>12</quantity></opportunityproduct>";

   // Update the opportunity product, and then retrieve it
   string strResultsXml = opportunityproduct.UpdateAndRetrieve (userAuth, strOpportunityProductId, strOpportunityXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMOpportunityProduct Class
  • Update


CRMPriceLevel Class

The CRMPriceLevel class contains methods that you can use to manage price levels.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMPriceLevel
[Visual Basic .NET]
Public Class CRMPriceLevel
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMPriceLevel : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMPriceLevel: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMPriceLevel class exposes the following methods.

Method | Description
Activate | Sets the state of a price level to Active.
Create | Creates a price level.
CreateAndRetrieve | Creates a price level and then retrieves it.
Deactivate | Sets the state of a price level to Inactive
Delete | Deletes a price level.
Retrieve | Retrieves a price level.
RetrieveByObject | Retrieves all price levels that are associated with an object (product).
RetrieveByOrganization | Retrieves all price levels that are associated with an organization.
Update | Updates a price level.
UpdateAndRetrieve | Updates a price level and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMPriceLevel.Activate Method

The Activate method sets the state of a price level to Active.

Syntax

[Visual Basic .NET]
Public Sub Activate(
  ByVal Caller As CUserAuth,
  ByVal PriceLevelId As String,
  ByVal Status As Integer
)
[C#]
public void Activate(
  CUserAuth  Caller,
  string  PriceLevelId,
  int  Status
);
[C++]
public: void Activate(
  CUserAuth*  Caller,
  String*  PriceLevelId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
PriceLevelId
Specifies the ID of the price level that is to be activated.
Status
Specifies the new status for the price level. The caller can use this parameter for application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMPriceLevel pricelevel = new Microsoft.Crm.Platform.Proxy.CRMPriceLevel();
pricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
pricelevel.Url = strDir + "CRMPriceLevel.srf";

string strErrorMsg;
string strPriceLevelId = "{CE6C8B90-4CDB-4C83-9986-57719B8DA83D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Activate the price level
   pricelevel.Activate(userAuth, strPriceLevelId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMPriceLevel Class


CRMPriceLevel.Create Method

The Create method creates a price level object.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal PriceLevelXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  PriceLevelXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  PriceLevelXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct privilege to perform this action. See CUserAuth.
PriceLevelXml
Specifies an XML string representing a price level. The XML schema is described by pricelevel.xsd.

Return Value

Returns a String type that specifies the ID of the new price level.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMPriceLevel pricelevel = new Microsoft.Crm.Platform.Proxy.CRMPriceLevel();
pricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
pricelevel.Url = strDir + "CRMPriceLevel.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the price level
   string strXml = "<pricelevel>";
   strXml += "<name>Price Level 1</name>";
   strXml += "<description>My description</description>";
   strXml += "</pricelevel>";

   // Create the price level
   string strPriceLevelId = pricelevel.Create(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMPriceLevel Class
  • Update


CRMPriceLevel.CreateAndRetrieve Method

The CreateAndRetrieve method creates a price level and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InPriceLevelXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InPriceLevelXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InPriceLevelXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct and prvReadProduct privileges to perform this action. See CUserAuth.
InPriceLevelXml
Specifies an XML string representing a price level. The XML schema is described by pricelevel.xsd.

Return Value

Returns a String type that specifies the XML data representing the new price level. The XML schema is described by pricelevel.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMPriceLevel pricelevel = new Microsoft.Crm.Platform.Proxy.CRMPriceLevel();
pricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
pricelevel.Url = strDir + "CRMPriceLevel.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the price level
   string strXml = "<pricelevel>";
   strXml += "<name>Price Level 2</name>";
   strXml += "<description>My description</description>";
   strXml += "</pricelevel>";

   // Create the price level, and then retrieve it
   string strNewPriceLevelXml = pricelevel.CreateAndRetrieve(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMPriceLevel Class
  • UpdateAndRetrieve


CRMPriceLevel.Deactivate Method

The Deactivate method sets the state of a price level to Inactive.

Syntax

[Visual Basic .NET]
Public Sub Deactivate(
  ByVal Caller As CUserAuth,
  ByVal PriceLevelId As String,
  ByVal Status As Integer
)
[C#]
public void Deactivate(
  CUserAuth  Caller,
  string  PriceLevelId,
  int  Status
);
[C++]
public: void Deactivate(
  CUserAuth*  Caller,
  String*  PriceLevelId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
PriceLevelId
Specifies the ID of the price level that is to be deactivated.
Status
Specifies the new status for the price level. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMPriceLevel pricelevel = new Microsoft.Crm.Platform.Proxy.CRMPriceLevel();
pricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
pricelevel.Url = strDir + "CRMPriceLevel.srf";

string strErrorMsg;
string strPriceLevelId = "{CE6C8B90-4CDB-4C83-9986-57719B8DA83D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Deactivate the price level
   pricelevel.Deactivate(userAuth, strPriceLevelId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMPriceLevel Class


CRMPriceLevel.Delete Method

The Delete method deletes a price level.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal PriceLevelId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  PriceLevelId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  PriceLevelId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteProduct privilege to perform this action. See CUserAuth.
PriceLevelId
Specifies the ID of the price level that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMPriceLevel pricelevel = new Microsoft.Crm.Platform.Proxy.CRMPriceLevel();
pricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
pricelevel.Url = strDir + "CRMPriceLevel.srf";

string strErrorMsg;
string strPriceLevelId = "{CE6C8B90-4CDB-4C83-9986-57719B8DA83D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the price level
   pricelevel.Delete(userAuth, strPriceLevelId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMPriceLevel Class


CRMPriceLevel.Retrieve Method

The Retrieve method retrieves a price level.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal PriceLevelId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  PriceLevelId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  PriceLevelId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
PriceLevelId
Specifies the ID of the price level that is to be retrieved.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in pricelevel.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the price level. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by pricelevel.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMPriceLevel pricelevel = new Microsoft.Crm.Platform.Proxy.CRMPriceLevel();
pricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
pricelevel.Url = strDir + "CRMPriceLevel.srf";

string strErrorMsg;
string strPriceLevelId = "{CE6C8B90-4CDB-4C83-9986-57719B8DA83D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the price level by ID
   string strResultsXml = pricelevel.Retrieve(userAuth, strPriceLevelId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMPriceLevel Class
  • RetrieveByOrganization


CRMPriceLevel.RetrieveByObject Method

The RetrieveByObject method retrieves all price levels that are associated with the specified object (product).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal StateCodes As Integer(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  int[]  StateCodes,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  long  StateCodes __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
Object
Specifies the object (product) for which you want to retrieve associated opportunities. See CObjectName.
StateCodes
Retrieves price levels that are in the states specified in this array. See PRICE_LEVEL_STATE.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in pricelevel.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the price level. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<pricelevels> + pricelevel1..N + </pricelevels>

where the XML schema for each price level is described by pricelevel.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMPriceLevel pricelevel = new Microsoft.Crm.Platform.Proxy.CRMPriceLevel();
pricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
pricelevel.Url = strDir + "CRMPriceLevel.srf";

string strErrorMsg;
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";
int[] arrStateCodes = new int[] {Microsoft.Crm.Platform.Types.PRICE_LEVEL_STATE.PLS_ACTIVE};

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Initialize the product object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strProductId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otProduct;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve price levels by product
   string strResultsXml = pricelevel.RetrieveByObject (userAuth, objName, arrStateCodes, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMPriceLevel Class
  • Retrieve
  • RetrieveByOrganization


CRMPriceLevel.RetrieveByOrganization Method

The RetrieveByOrganization method retrieves all price levels that are associated with an organization.

Syntax

[Visual Basic .NET]
Public Function RetrieveByOrganization(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal StateCodes As Integer(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByOrganization(
  CUserAuth  Caller,
  string  OrganizationId,
  int[]  StateCodes,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByOrganization(
  CUserAuth*  Caller,
  String*  OrganizationId,
  long  StateCodes __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
StateCodes
Retrieves price levels that are in the states specified in this array. See PRICE_LEVEL_STATE.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in pricelevel.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of price levels associated with the specified organization. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<pricelevels> + pricelevel1..N + </pricelevels>

where the XML schema for each price level is described by pricelevel.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMPriceLevel pricelevel = new Microsoft.Crm.Platform.Proxy.CRMPriceLevel();
pricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
pricelevel.Url = strDir + "CRMPriceLevel.srf";

string strErrorMsg;
string strOrganizationId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";
int[] arrStateCodes = new int[] {Microsoft.Crm.Platform.Types.PRICE_LEVEL_STATE.PLS_ACTIVE };

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the price levels for the organization
   string strResultsXml = pricelevel.RetrieveByOrganization(userAuth, strOrganizationId, arrStateCodes, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMPriceLevel Class
  • Retrieve


CRMPriceLevel.Update Method

The Update method updates a price level.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal PriceLevelId As String,
  ByVal PriceLevelXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  PriceLevelId,
  string  PriceLevelXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  PriceLevelId,
  String*  PriceLevelXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
PriceLevelId
Specifies the ID of the price level that is to be updated.
PriceLevelXml
Specifies an XML string representing a price level. The XML schema is described by pricelevel.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMPriceLevel pricelevel = new Microsoft.Crm.Platform.Proxy.CRMPriceLevel();
pricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
pricelevel.Url = strDir + "CRMPriceLevel.srf";

string strErrorMsg;
string strPriceLevelId = "{CE6C8B90-4CDB-4C83-9986-57719B8DA83D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the price level
   string strXml = "<pricelevel>";
   strXml += "<name>Price Level 4</name>";
   strXml += "<description>My description</description>";
   strXml += "</pricelevel>";

   // Update the price level
   pricelevel.Update(userAuth, strPriceLevelId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMPriceLevel Class
  • UpdateAndRetrieve


CRMPriceLevel.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a price level and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal PriceLevelId As String,
  ByVal InPriceLevelXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  PriceLevelId,
  string  InPriceLevelXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  PriceLevelId,
  String*  InPriceLevelXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct and prvReadProduct privileges to perform this action. See CUserAuth.
PriceLevelId
Specifies the ID of the price level that is to be updated.
InPriceLevelXml
Specifies an XML string representing a price level. The XML schema is described by pricelevel.xsd.

Return Value

Returns a String type that specifies the XML data representing the updated price level. The XML schema is described by pricelevel.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMPriceLevel   pricelevel = new Microsoft.Crm.Platform.Proxy.CRMPriceLevel();
pricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
pricelevel.Url = strDir + "CRMPriceLevel.srf";

string strErrorMsg;
string strPriceLevelId = "{CE6C8B90-4CDB-4C83-9986-57719B8DA83D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the price level
   string strXml = "<pricelevel>";
   strXml += "<name>Price Level 4</name>";
   strXml += "<description>My description</description>";
   strXml += "</pricelevel>";

   // Update the price level, and then retrieve it
   string strResultsXml = pricelevel.UpdateAndRetrieve(userAuth, strPriceLevelId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMPriceLevel Class
  • Update


CRMProcess Class

The CRMProcess class contains methods that you can use to manage workflow process objects.

Note Workflow processes that are created by using the methods in the CRMProcess class and CRMProcessController class do not display any details in the Microsoft CRM Workflow Manager and Workflow Monitor tools. You can see the line items for your custom processes in these tools, but the detail windows are empty.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMProcess
[Visual Basic .NET]
Public Class CRMProcess
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMProcess : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMProcess: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMProcess class exposes the following methods.

Method | Description
Activate | Activates a workflow process.
ChangePriority | Changes the priority of the specified workflow process.
Clone | Copies a workflow process.
Create | Creates a workflow process.
CreateAction | Creates an action for a process step.
CreateActionParameter | Creates a parameter for an action.
CreateAll | Creates a workflow process and all of its sub-elements.
CreateAndRetrieve | Creates a workflow process and then retrieves it.
CreateCondition | Creates a condition for a rule.
CreateConditionParameter | Creates a parameter for a condition.
CreateRule | Creates a rule for a process step.
CreateStep | Creates a step in a workflow process.
Deactivate | Deactivates a workflow process.
Delete | Deletes a workflow process.
DeleteAction | Deletes an action for a process step.
DeleteActionParameter | Deletes a parameter for an action.
DeleteCondition | Deletes a condition for a rule.
DeleteConditionParameter | Deletes a parameter for a condition.
DeleteRule | Deletes a rule for a process step.
DeleteStep | Deletes a step in a workflow process.
GetEntityByAttributeId | Retrieves the XML data for an obect by the specified attribute ID.
GetEntityByEntityId | Retrieves the XML data for an object by its ID.
GetEntityByName | Retrieves the XML data for an object by its name.
GetEntityByObjectType | Retrieves the XML data for an object by its object type.
Retrieve | Retrieves a workflow process.
RetrieveAction | Retrieves the specified action for a process step.
RetrieveActionParameter | Retrieves the specified parameter for an action.
RetrieveActionParameters | Retrieves all parameters for an action.
RetrieveActions | Retrieves all actions for a process step.
RetrieveAll | Retrieves a workflow process and all of its sub-elements.
RetrieveByCategory | Retrieves the processes for the specified object type. The caller must have read privileges for the specified object type.
RetrieveCondition | Retrieves a condition for a rule.
RetrieveConditionParameter | Retrieves the specified parameter for a condition.
RetrieveConditionParameters | Retrieves all parameters for a condition.
RetrieveLeftSteps | Retrieves all of the steps that precede the specified step.
RetrieveRightSteps | Retrieves all of the steps that follow the specified step.
RetrieveRule | Retrieves the specified rule for a process step.
RetrieveRuleConditions | Retrieves all conditions for a rule.
RetrieveRules | Retrieves all rules for a process step.
RetrieveStep | Retrieves the specified step in a workflow process.
RetrieveStepConditions | Retrieves all conditions for a step.
RetrieveSteps | Retrieves all steps of a process.
Update | Updates a workflow process.
UpdateAction | Updates an action for a process step.
UpdateActionParameter | Updates a parameter for an action.
UpdateAll | Updates (overwrites) a workflow process and all of its sub-elements.
UpdateAndRetrieve | Updates a workflow process and then retrieves it.
UpdateCondition | Updates a condition for a rule.
UpdateConditionParameter | Updates a parameter for a condition.
UpdateRule | Updates a rule for a process step.
UpdateStep | Updates a step in a workflow process.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMProcess.Activate Method

The Activate method activates a workflow process, which means it compiles and copies (clones) the process so that the process can be executed. It also sets the process statecode to WFPS_ACTIVE. See Remarks.

Syntax

[Visual Basic .NET]
Public Function Activate(
  ByVal Caller As CUserAuth,
  ByVal ProcessId As String,
  ByRef ErrInfo As CWorkflowErrorInfo()
) As Integer
[C#]
public int Activate(
  CUserAuth  Caller,
  string  ProcessId,
  out CWorkflowErrorInfo[]  ErrInfo
);
[C++]
public: long Activate(
  CUserAuth*  Caller,
  String*  ProcessId,
  CWorkflowErrorInfo**  ErrInfo
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcess privilege to perform this action. See CUserAuth.
ProcessId
Specifies the ID of the process that is to be activated.
ErrInfo
[out] Specifies an array of error information structures. Any compile errors during process activation are reported in this structure. See CWorkflowErrorInfo.

Return Value

Returns an Int32 type that specifies the flag indicating either success (non-zero) or failure (zero). If the call fails, the errInfo structure contains the reason for the failure.

Remarks

For this method to succeed, the specified process must not yet have been activated. After the process is activated, a copy (clone) of the process is created; And it is this copy on which the process instances run. This makes it possible to modify or delete the original process without affecting the process instances. Because of this implementation, the GUIDs that are returned from CRMProcessController APIs and that are listed in errors in the System Event Log refer to GUIDs from the copied process.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

   Microsoft.Crm.Platform.Proxy.CWorkflowErrorInfo[] errinfo = new Microsoft.Crm.Platform.Proxy.CWorkflowErrorInfo[]{};

   // Activate the process
   int error = process.Activate(userAuth, strProcessId, out errinfo);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Workflow Reference


CRMProcess.ChangePriority Method

The ChangePriority method changes the priority field of the specified workflow process. The priority field determines the sequence in which workflow processes are instantiated. For example, a process with a priority of 1 is instantiated before a process with priority 2.

Syntax

[Visual Basic .NET]
Public Sub ChangePriority(
  ByVal Caller As CUserAuth,
  ByVal ProcessId As String,
  ByVal Priority As Integer
)
[C#]
public void ChangePriority(
  CUserAuth  Caller,
  string  ProcessId,
  int  Priority
);
[C++]
public: void ChangePriority(
  CUserAuth*  Caller,
  String*  ProcessId,
  long  Priority
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcess privilege to perform this action. See CUserAuth.
ProcessId
Specifies the ID of the process.
Priority
Specifies the new priority for the process.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

   // Change the priority of the process
   process.ChangePriority(userAuth, strProcessId, 1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Workflow Reference


CRMProcess.Clone Method

The Clone method copies a workflow process.

Syntax

[Visual Basic .NET]
Public Function Clone(
  ByVal Caller As CUserAuth,
  ByVal ProcessId As String
) As String
[C#]
public string Clone(
  CUserAuth  Caller,
  string  ProcessId
);
[C++]
public: String* Clone(
  CUserAuth*  Caller,
  String*  ProcessId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateWorkflowProcess privilege to perform this action. See CUserAuth.
ProcessId
Specifies the ID of the process that is to be copied.

Return Value

Returns a String type that specifies the ID of the new copy of the workflow process.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

   // Copy the process
   string strNewProcessId = process.Clone(userAuth, strProcessId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Workflow Reference


CRMProcess.Create Method

The Create method creates a workflow process, which includes creating the initial step of the process.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal Process As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  Process
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  Process
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateWorkflowProcess privilege to perform this action. See CUserAuth.
Process
Specifies an XML string describing the workflow process. The XML schema is described by wfprocess.xsd.

Return Value

Returns a String type that specifies the ID of the new workflow process.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   process.Timeout = -1;

   // Set up XML string for the process
   string strXml = "<wfprocess>";
   strXml += "<name>My Process Name</name>";
   strXml += "<description>My New Process Adventure Works</description>";
   strXml += "<processtypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PROCESS_TYPE.WFPT_WORKFLOW_PROCESS.ToString() + "</processtypecode>";
   strXml += "<entitytype>" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString() + "</entitytype>";
   strXml += "<eventtypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_EVENT_TYPE.WFET_CREATED.ToString() + "</eventtypecode>";
   strXml += "<usercontext>" + userAuth.UserId + "</usercontext>";
   strXml += "<businessunitid>" + userAuth.MerchantId + "</businessunitid>";
   strXml += "</wfprocess>";

   // Create the process
   string strProcessId = process.Create(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAction
  • CreateActionParameter
  • CreateAll
  • CreateAndRetrieve
  • CreateCondition
  • CreateConditionParameter
  • CreateRule
  • CreateStep
  • CRMProcess Class
  • Update
  • Workflow Reference


CRMProcess.CreateAction Method

The CreateAction method creates an action for a process step.

Syntax

[Visual Basic .NET]
Public Function CreateAction(
  ByVal Caller As CUserAuth,
  ByVal Action As String
) As String
[C#]
public string CreateAction(
  CUserAuth  Caller,
  string  Action
);
[C++]
public: String* CreateAction(
  CUserAuth*  Caller,
  String*  Action
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateWorkflowProcess privilege to perform this action. See CUserAuth.
Action
Specifies an XML string describing the action. The XML schema is described by wfaction.xsd.

Return Value

Returns a String type that specifies the ID of the new action.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

string strStepId = "{72798DBF-7A8F-413B-AFEA-B85EF5363609}";

   string strActionXml = " <wfaction>";
   strActionXml += "<name>My Action Name</name>";
   strActionXml += "<stepid>" + strStepId + "</stepid>";
   strActionXml += "<actiontypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_ACTION_TYPE.WFAT_CREATE_NOTE.ToString() + "</actiontypecode>";
   strActionXml += "</wfaction>";

   // Create an action for the process step
   string strActionId = process.CreateAction(userAuth, strActionXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CreateActionParameter
  • CRMProcess Class
  • UpdateAction
  • Workflow Reference


CRMProcess.CreateActionParameter Method

The CreateActionParameter method creates a parameter for an action.

Syntax

[Visual Basic .NET]
Public Function CreateActionParameter(
  ByVal Caller As CUserAuth,
  ByVal Parameter As String
) As String
[C#]
public string CreateActionParameter(
  CUserAuth  Caller,
  string  Parameter
);
[C++]
public: String* CreateActionParameter(
  CUserAuth*  Caller,
  String*  Parameter
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateWorkflowProcess privilege to perform this action. See CUserAuth.
Parameter
Specifies an XML string describing the action parameter. The XML schema is described by wfparameter.xsd.

Return Value

Returns a String type that specifies the ID of the new parameter.

Remarks

For more information about parametertype, see WORKFLOW_PARAMETER_TYPE.

For more information about actiontype, see WORKFLOW_ACTION_TYPE.

For more information about datatype, see WORKFLOW_DATA_TYPE.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strActionId = "{13B74186-DB40-480F-AD31-F20432502F97}";

   string strXml = " <wfparameter>";
   strXml += "<actionid>" + strActionId + "</actionid>";
   strXml += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_VALUE.ToString() + "</parametertypecode>";
   strXml += "<value>Parameter Value</value>";
   strXml += "</wfparameter>";

   // Create the parameter
   string strActionParameterId = process.CreateActionParameter(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CreateAction
  • CRMProcess Class
  • UpdateActionParameter
  • Workflow Reference


CRMProcess.CreateAll Method

The CreateAll method creates a workflow process and all of its sub-elements.

Syntax

[Visual Basic .NET]
Public Function CreateAll(
  ByVal Caller As CUserAuth,
  ByVal Process As CWorkflowProcess
) As String
[C#]
public string CreateAll(
  CUserAuth  Caller,
  CWorkflowProcess  Process
);
[C++]
public: String* CreateAll(
  CUserAuth*  Caller,
  CWorkflowProcess*  Process
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateWorkflowProcess privilege to perform this action. See CUserAuth.
Process
Specifies a CWorkflowProcess structure that stores a flat workflow process. See CWorkflowProcess.

Return Value

Returns a String type that specifies the ID of the new process.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
Microsoft.Crm.Platform.Proxy.CWorkflowProcess oprocess;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Instantiate the new process
   oprocess = new Microsoft.Crm.Platform.Proxy.CWorkflowProcess();

   // Set up the XML schema to create a process and all of its elements
   // Process
   oprocess.Process = "<wfprocess><processid>{BDECFD06-F06C-47D7-AECE-FD76AE4DCC2F}</processid>";
   oprocess.Process += "<eventtypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_EVENT_TYPE.WFET_ASSIGNED.ToString() + "</eventtypecode>";
   oprocess.Process += "<initialstepid>{9B5B8D1A-DB46-4672-B1F9-44ADF61233E4}</initialstepid>";
   oprocess.Process += "<businessunitid>{056FBBDF-1585-424C-8267-3D31E4C6DFB2}</businessunitid>";
   oprocess.Process += "<usercontext>{09AAD3AF-21B3-4C67-B2B7-90C9CF87396A}</usercontext>";
   oprocess.Process += "<name>rule1</name>";
   oprocess.Process += "<processtypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PROCESS_TYPE.WFPT_WORKFLOW_PROCESS.ToString().ToString() + "</processtypecode>";
   oprocess.Process += "<processtypeversion>10000</processtypeversion>";
   oprocess.Process += "<entitytype> " + Microsoft.Crm.Platform.Proxy.ObjectType.otActivity.ToString() + "</entitytype>";
   oprocess.Process += "<description>My description</description>";
   oprocess.Process += "<priority>100</priority></wfprocess>";

   // Steps
   oprocess.Steps = "<wfsteps><wfstep><stepid>{3456E782-444F-49CA-83B3-4212C3EE1437}</stepid>";
   oprocess.Steps += "<processid>{BDECFD06-F06C-47D7-AECE-FD76AE4DCC2F}</processid> ";
   oprocess.Steps += "<name>ifelse step</name></wfstep>";

   oprocess.Steps += "<wfstep><stepid>{9B5B8D1A-DB46-4672-B1F9-44ADF61233E4}</stepid>";
   oprocess.Steps += "<processid>{BDECFD06-F06C-47D7-AECE-FD76AE4DCC2F}</processid>";
   oprocess.Steps += "<name>init step</name></wfstep>";
   oprocess.Steps += "<wfstep><stepid>{479D2897-A74F-439D-B431-4E7168C4E050}</stepid>";
   oprocess.Steps += "<processid>{BDECFD06-F06C-47D7-AECE-FD76AE4DCC2F}</processid>";
   oprocess.Steps += "<name>action step</name></wfstep>";
   oprocess.Steps += "<wfstep><stepid>{B1895C78-156E-4DC7-ADAF-EC46D2CA74D9}</stepid>";
   oprocess.Steps += "<processid>{BDECFD06-F06C-47D7-AECE-FD76AE4DCC2F}</processid>";
   oprocess.Steps += "<name>exit step</name></wfstep>";
   oprocess.Steps += "<wfstep><stepid>{D6B24B69-92A3-4A38-9E8A-FAE2D85D64B9}</stepid>";
   oprocess.Steps += "<processid>{BDECFD06-F06C-47D7-AECE-FD76AE4DCC2F}</processid>";
   oprocess.Steps += "<name>Wait for 0 min</name>";
   oprocess.Steps += "<description>Wait for 0 min</description></wfstep></wfsteps>";

   // Actions
   oprocess.Actions = "<wfactions><wfaction><actionid>{CC69A5AB-B3A3-4D7F-A27F-F67F32583630}</actionid>";
   oprocess.Actions += "<stepid>{479D2897-A74F-439D-B431-4E7168C4E050}</stepid>";
   oprocess.Actions += "<name>PostUrl:http://www.microsoft.com </name>";
   oprocess.Actions += "<actiontypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_ACTION_TYPE.WFAT_POST_URL.ToString() + "</actiontypecode>";
   oprocess.Actions += "<description>PostUrl</description>";
   oprocess.Actions += "<orderofexecution>1</orderofexecution>";
   oprocess.Actions += "<errorhandler>" + Microsoft.Crm.Platform.Types.WORKFLOW_ERROR_HANDLER_LEVEL.WFEH_STOP.ToString() + "</errorhandler></wfaction>";

   oprocess.Actions += "<wfaction><actionid>{31782FB3-C8E8-4229-90F3-5529C0EF12FF}</actionid>";
   oprocess.Actions += "<stepid>{D6B24B69-92A3-4A38-9E8A-FAE2D85D64B9}</stepid>";
   oprocess.Actions += "<name>Timer</name>;
   oprocess.Actions += "<actiontypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_ACTION_TYPE.WFAT_TIMER.ToString() + "</actiontypecode>";
   oprocess.Actions += "<description>Timer</description><orderofexecution>0</orderofexecution>";
   oprocess.Actions += "<errorhandler>" + Microsoft.Crm.Platform.Types.WORKFLOW_ERROR_HANDLER_LEVEL.WFEH_STOP.ToString() + "</errorhandler</wfaction></wfactions>";";

   // Action parameters
   string wfparam = "<wfparameters><wfparameter><parameterid>{B0647D67-1738-4B06-A8A6-90CE9441E49F}</parameterid>";
   wfparam += "<actionid>{31782FB3-C8E8-4229-90F3-5529C0EF12FF}</actionid>";
   wfparam += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_DATEADD + "</parametertypecode>";
   wfparam += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_VARIANT + "</datatype>";
   wfparam += "<orderofevaluation>0</orderofevaluation></wfparameter>";

   wfparam += "<wfparameter><parameterid>{FE3274DE-BE15-42CB-AB94-7A849295D7C2}</parameterid>";
   wfparam += "<parentid>{B0647D67-1738-4B06-A8A6-90CE9441E49F}</parentid>";
   wfparam += "<actionid>{31782FB3-C8E8-4229-90F3-5529C0EF12FF}</actionid>";
   wfparam += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_AND.ToString() + "</parametertypecode>";
   wfparam += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_VARIANT + "</datatype>";
   wfparam += "<orderofevaluation>1</orderofevaluation></wfparameter>";

   wfparam += "<wfparameter><parameterid>{A21AB032-FA2E-4A3B-8254-9494D82BA1AB}</parameterid>";
   wfparam += "<parentid>{B0647D67-1738-4B06-A8A6-90CE9441E49F}</parentid>";
   wfparam += "<actionid>{31782FB3-C8E8-4229-90F3-5529C0EF12FF}</actionid>";
   wfparam += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_ACTION.ToString()  + "</parametertypecode>";
   wfparam += "<value>0</value>";
   wfparam += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_INTEGER + "</datatype>";
   wfparam += "<orderofevaluation>2</orderofevaluation></wfparameter>";

   wfparam += "<wfparameter><parameterid>{F13B3197-221A-4D4C-B439-D09BA74EC884}</parameterid>";
   wfparam += "<parentid>{B0647D67-1738-4B06-A8A6-90CE9441E49F}</parentid>";
   wfparam += "<actionid>{31782FB3-C8E8-4229-90F3-5529C0EF12FF}</actionid>";
   wfparam += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_ACTION.ToString()  + "</parametertypecode>";
   wfparam += "<value>0</value>";
   wfparam += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_INTEGER + "</datatype>";
   wfparam += "<orderofevaluation>3</orderofevaluation></wfparameter>";

   wfparam += "<wfparameter><parameterid>{DDCE39E6-5ABA-49F0-9788-233F6B9D6A27}</parameterid>";
   wfparam += "<parentid>{B0647D67-1738-4B06-A8A6-90CE9441E49F}</parentid>";
   wfparam += "<actionid>{31782FB3-C8E8-4229-90F3-5529C0EF12FF}</actionid>";
   wfparam += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_ACTION.ToString()  + "</parametertypecode>";
   wfparam += "<value>0</value>";
   wfparam += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_INTEGER + "</datatype>";
   wfparam += "<orderofevaluation>4</orderofevaluation></wfparameter>";

   wfparam += "<wfparameter><parameterid>{1F87EB07-7AA5-4872-B479-F1194667C71C}</parameterid>";
   wfparam += "<parentid>{B0647D67-1738-4B06-A8A6-90CE9441E49F}</parentid>";
   wfparam += "<actionid>{31782FB3-C8E8-4229-90F3-5529C0EF12FF}</actionid>";
   wfparam += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_AND.ToString() + "</parametertypecode>";
   wfparam += "<value>0</value>";
   wfparam += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_INTEGER + "</datatype>";
   wfparam += "<orderofevaluation>5</orderofevaluation></wfparameter>";

   wfparam += "<wfparameter><parameterid>{0E67DC96-DAD0-4E4A-A19E-89BB1DB32398}</parameterid>";
   wfparam += "<parentid>{B0647D67-1738-4B06-A8A6-90CE9441E49F}</parentid>";
   wfparam += "<actionid>{31782FB3-C8E8-4229-90F3-5529C0EF12FF}</actionid>";
   wfparam += "<parametertypecode> " + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_ACTION.ToString()  + "</parametertypecode>";
   wfparam += "<value>0</value>";
   wfparam += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_INTEGER + "</datatype>";
   wfparam += "<orderofevaluation>6</orderofevaluation></wfparameter>";

   wfparam += "<wfparameter><parameterid>{9801E14B-EA92-4C13-93BA-0A95470BCD10}</parameterid>";
   wfparam += "<actionid>{CC69A5AB-B3A3-4D7F-A27F-F67F32583630}</actionid>";
   wfparam += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_AND.ToString() + "</parametertypecode>";
   wfparam += "<value>http://www.microsoft.com</value><name>url</name>";
   wfparam += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_VARIANT + "</datatype>";
   wfparam += "<orderofevaluation>0</orderofevaluation></wfparameter>";

   wfparam += "<wfparameter><parameterid>{40C56DD9-81BB-426A-9FF1-75635C417398}</parameterid>";
   wfparam += "<actionid>{CC69A5AB-B3A3-4D7F-A27F-F67F32583630}</actionid>";
   wfparam += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_ACTION.ToString()  + "</parametertypecode>";
   wfparam += "<attributeid>{3FE79603-7266-424F-B8B9-DA0636B4D169}</attributeid>";
   wfparam += "<name>accountid</name>";
   wfparam += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_VARIANT + "</datatype>";
   wfparam += "<orderofevaluation>1</orderofevaluation></wfparameter></wfparameters>";

   oprocess.ActionParameters = wfparam;

   // Rules
   oprocess.Rules = "<wfrules><wfrule><ruleid>{87E77886-B446-411A-848B-4CBED74F7FD5}</ruleid> ";
   oprocess.Rules += "<nextstepid>{479D2897-A74F-439D-B431-4E7168C4E050}</nextstepid> ";
   oprocess.Rules += "<stepid>{3456E782-444F-49CA-83B3-4212C3EE1437}</stepid> ";
   oprocess.Rules += "<orderofevaluation>0</orderofevaluation></wfrule> ";

   oprocess.Rules += "<wfrule><ruleid>{6E5C3590-4A07-4E8A-B576-0952321DC6E4}</ruleid> ";
   oprocess.Rules += "<nextstepid>{B1895C78-156E-4DC7-ADAF-EC46D2CA74D9}</nextstepid> ";
   oprocess.Rules += "<stepid>{3456E782-444F-49CA-83B3-4212C3EE1437}</stepid> ";
   oprocess.Rules += "<orderofevaluation>1000000</orderofevaluation></wfrule> ";

   oprocess.Rules += "<wfrule><ruleid>{79834EFE-36E6-45FB-BF44-C9F36416B6E0}</ruleid> ";
   oprocess.Rules += "<nextstepid>{D6B24B69-92A3-4A38-9E8A-FAE2D85D64B9}</nextstepid> ";
   oprocess.Rules += "<stepid>{9B5B8D1A-DB46-4672-B1F9-44ADF61233E4}</stepid> ";
   oprocess.Rules += "<orderofevaluation>1000000</orderofevaluation></wfrule> ";

   oprocess.Rules += "<wfrule><ruleid>{E2A2EB1F-3F55-4B40-A2B0-A0C22B4213F8}</ruleid> ";
   oprocess.Rules += "<nextstepid>{B1895C78-156E-4DC7-ADAF-EC46D2CA74D9}</nextstepid> ";
   oprocess.Rules += "<stepid>{479D2897-A74F-439D-B431-4E7168C4E050}</stepid> ";
   oprocess.Rules += "<orderofevaluation>1000000</orderofevaluation></wfrule> ";

   oprocess.Rules += "<wfrule><ruleid>{3293FBDF-B46D-4513-9D46-AFBA98D23524}</ruleid> ";
   oprocess.Rules += "<stepid>{B1895C78-156E-4DC7-ADAF-EC46D2CA74D9}</stepid> ";
   oprocess.Rules += "<orderofevaluation>1000000</orderofevaluation></wfrule>";

   oprocess.Rules += "<wfrule><ruleid>{87C05451-F620-482E-BF28-9793B13CEDFF}</ruleid>";
   oprocess.Rules += "<nextstepid>{3456E782-444F-49CA-83B3-4212C3EE1437}</nextstepid>";
   oprocess.Rules += "<stepid>{D6B24B69-92A3-4A38-9E8A-FAE2D85D64B9}</stepid>";
   oprocess.Rules += "<orderofevaluation>1000000</orderofevaluation></wfrule></wfrules>";";

   // Conditions
   oprocess.Conditions = "<wfconditions><wfcondition><conditionid>{D86181AF-79E9-4071-897D-FD8509D3174C}</conditionid>";
   oprocess.Conditions += "<ruleid>{87C05451-F620-482E-BF28-9793B13CEDFF}</ruleid>";
   oprocess.Conditions += "<orderofevaluation>1</orderofevaluation></wfcondition></wfconditions>";

   // Condition parameters
   string condparm = "<wfparameters><wfparameter><parameterid>{B0B46630-A13E-4D7E-B08B-53545AA45768}</parameterid>";
   condparm += "<conditionid>{D86181AF-79E9-4071-897D-FD8509D3174C}</conditionid>";
   condparm += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_ANY_ACTION.ToString() + "</parametertypecode>";
   condparm += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_BOOLEAN.ToString() + "</datatype>";
   condparm += "<orderofevaluation>0</orderofevaluation></wfparameter>";

   condparm += "<wfparameter><parameterid>{FCFF64D8-9F3B-4FE1-AE35-30D0A025E38E}</parameterid>";
   condparm += "<parentid>{B0B46630-A13E-4D7E-B08B-53545AA45768}</parentid>";
   condparm += "<conditionid>{D86181AF-79E9-4071-897D-FD8509D3174C}</conditionid>";
   condparm += "<parametertypecode>" +  Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_ANY_ACTION.ToString() + "</parametertypecode>";
   condparm += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_DATETIME.ToString() + "</datatype>";
   condparm += "<orderofevaluation>1</orderofevaluation></wfparameter>";

   condparm += "<wfparameter><parameterid>{952852BB-8B6B-43CA-9A14-6CBDDC9A9E5A}</parameterid>";
   condparm += "<parentid>{B0B46630-A13E-4D7E-B08B-53545AA45768}</parentid>";
   condparm += "<conditionid>{D86181AF-79E9-4071-897D-FD8509D3174C}</conditionid>";
   condparm += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_ANY_ACTION.ToString()  + "</parametertypecode>";
   condparm += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_DATETIME.ToString() + "</datatype>";
   condparm += "<orderofevaluation>2</orderofevaluation></wfparameter>";

   condparm += "<wfparameter><parameterid>{AEEC3549-4DC6-493E-87F8-55E604C2A77B}</parameterid>";
   condparm += "<parentid>{952852BB-8B6B-43CA-9A14-6CBDDC9A9E5A}</parentid>";
   condparm += "<conditionid>{D86181AF-79E9-4071-897D-FD8509D3174C}</conditionid>";
   condparm += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_ANY_ACTION.ToString()  + "</parametertypecode>";
   condparm += "<attributeid>{7FEAE2DD-843C-475B-B350-4545BFED238E}</attributeid>";
   condparm += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_VARIANT.ToString() + "</datatype>";
   condparm += "<orderofevaluation>3</orderofevaluation></wfparameter>";

   condparm += "<wfparameter><parameterid>{047E9D0C-3E78-4B2D-ADEC-C6ECD1775013}</parameterid>";
   condparm += "<parentid>{952852BB-8B6B-43CA-9A14-6CBDDC9A9E5A}</parentid>";
   condparm += "<conditionid>{D86181AF-79E9-4071-897D-FD8509D3174C}</conditionid>";
   condparm += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_ANY_ACTION.ToString()  + "</parametertypecode>";
   condparm += "<value>0</value>";
   condparm += "<name>years</name>";
   condparm += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_INTEGER.ToString() + "</datatype>";
   condparm += "<orderofevaluation>4</orderofevaluation></wfparameter>";

   condparm += "<wfparameter><parameterid>{5D820222-D422-4CD5-9A09-6FA36BC1EEDF}</parameterid>";
   condparm += "<parentid>{952852BB-8B6B-43CA-9A14-6CBDDC9A9E5A}</parentid>";
   condparm += "<conditionid>{D86181AF-79E9-4071-897D-FD8509D3174C}</conditionid>";
   condparm += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_AND.ToString() + "</parametertypecode>";
   condparm += "<value>0</value><name>months</name>";
   condparm += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_INTEGER.ToString() + "</datatype>";
   condparm += "<orderofevaluation>5</orderofevaluation></wfparameter>";

   condparm += "<wfparameter><parameterid>{832B322B-521B-486E-AFA7-B52DF66A9CBC}</parameterid>";
   condparm += "<parentid>{952852BB-8B6B-43CA-9A14-6CBDDC9A9E5A}</parentid>";
   condparm += "<conditionid>{D86181AF-79E9-4071-897D-FD8509D3174C}</conditionid>";
   condparm += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_AND.ToString() + "</parametertypecode>";
   condparm += "<value>0</value><name>days</name>";
   condparm += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_INTEGER.ToString() + "</datatype>";
   condparm += "<orderofevaluation>6</orderofevaluation></wfparameter>";

   condparm += "<wfparameter><parameterid>{C401F770-91A1-46DA-94D8-6BBA8C2384E5}</parameterid>";
   condparm += "<parentid>{952852BB-8B6B-43CA-9A14-6CBDDC9A9E5A}</parentid>";
   condparm += "<conditionid>{D86181AF-79E9-4071-897D-FD8509D3174C}</conditionid>";
   condparm += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_AND.ToString() + "</parametertypecode>";
   condparm += "<value>0</value><name>hours</name>";
   condparm += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_INTEGER.ToString() + "</datatype>";
   condparm += "<orderofevaluation>7</orderofevaluation></wfparameter>";

   condparm += "<wfparameter><parameterid>{074E8B66-366A-4983-9797-686498F1A612}</parameterid>";
   condparm += "<parentid>{952852BB-8B6B-43CA-9A14-6CBDDC9A9E5A}</parentid>";
   condparm += "<conditionid>{D86181AF-79E9-4071-897D-FD8509D3174C}</conditionid>";
   condparm += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_AND.ToString() + "</parametertypecode>";
   condparm += "<value>0</value><name>minutes</name>";
   condparm += "<datatype>" + Microsoft.Crm.Platform.Types.WORKFLOW_DATA_TYPE.WFDT_INTEGER.ToString() + "</datatype>";
   condparm += "<orderofevaluation>8</orderofevaluation></wfparameter></wfparameters>";

oprocess.ConditionParameters  = condparm;

   // Create the workflow process with all of its elements
   string strProcessId = process.CreateAll(userAuth, oprocess);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CreateRule
  • CRMProcess Class
  • UpdateAll
  • Workflow Reference


CRMProcess.CreateAndRetrieve Method

The CreateAndRetrieve method creates a workflow process and then returns it. This creates a workflow process and an initial step.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InProcessXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InProcessXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InProcessXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateWorkflowProcess and prvReadWorkflowProcess privileges to perform this action. See CUserAuth.
InProcessXML
Specifies an XML string describing the workflow process. The XML schema is described by wfprocess.xsd.

Return Value

Returns a String type that specifies the XML data containing the new process. The XML schema is described by wfprocess.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   process.Timeout = -1;

   // Set up the XML string for the process
   string strXml = "<wfprocess>";
   strXml += "<name>My Process Name</name>";
   strXml += "<description>My New Process Adventure Works</description>";
   strXml += "<processtypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PROCESS_TYPE.WFPT_WORKFLOW_PROCESS.ToString() + "</processtypecode>";
   strXml += "<entitytype>" + Microsoft.Crm.Platform.Types.ObjectType.otLead.ToString() + "</entitytype>";
   strXml += "<eventtypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_EVENT_TYPE.WFET_CREATED.ToString() + "</eventtypecode>";
   strXml += "<usercontext>" + userAuth.UserId + "</usercontext>";
   strXml += "<businessunitid>" + userAuth.MerchantId + "</businessunitid>";
   strXml += "</wfprocess>";

   // Create and then retrieve the process
   string strProcessXml = process.CreateAndRetrieve(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMProcess Class
  • UpdateAndRetrieve
  • Workflow Reference


CRMProcess.CreateCondition Method

The CreateCondition method creates a condition for a rule.

Syntax

[Visual Basic .NET]
Public Function CreateCondition(
  ByVal Caller As CUserAuth,
  ByVal Condition As String
) As String
[C#]
public string CreateCondition(
  CUserAuth  Caller,
  string  Condition
);
[C++]
public: String* CreateCondition(
  CUserAuth*  Caller,
  String*  Condition
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateWorkflowProcess privilege to perform this action. See CUserAuth.
Condition
Specifies an XML string describing the condition. The XML schema is described by wfcondition.xsd.

Return Value

Returns a String type that specifies the ID of the new condition.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strRuleId = "{FC0C4939-7AD1-4BA8-B418-6D4D55459833}";

   // Set up the XML string for the condition
   string strConditionXml = "<wfcondition>";
   strConditionXml += "<ruleid>" + strRuleId + "</ruleid>";
   // For condition type, code is user defined
   strConditionXml += "<conditiontypecode>4</conditiontypecode>";
   strConditionXml += "</wfcondition>";

   // Create the condition
   string strConditionId = process.CreateCondition(userAuth, strConditionXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CreateConditionParameter
  • CRMProcess Class
  • UpdateCondition
  • Workflow Reference


CRMProcess.CreateConditionParameter Method

The CreateConditionParameter method creates a parameter for a condition.

Syntax

[Visual Basic .NET]
Public Function CreateConditionParameter(
  ByVal Caller As CUserAuth,
  ByVal Parameter As String
) As String
[C#]
public string CreateConditionParameter(
  CUserAuth  Caller,
  string  Parameter
);
[C++]
public: String* CreateConditionParameter(
  CUserAuth*  Caller,
  String*  Parameter
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateWorkflowProcess privilege to perform this action. See CUserAuth.
Parameter
Specifies an XML string describing the parameter. The XML schema is described by wfparameter.xsd.

Return Value

Returns a String type that specifies the ID of the new parameter.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strConditionId = "{D9A55D5B-390B-4DAC-87C8-F38AD2169F38}";

   int pcode = Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_EQ.ToString();

   string strXml = "<wfparameter>";
   strXml += "<conditionid>" + strConditionId + "</conditionid>";
   strXml += "<parametertypecode>" + pcode + "</parametertypecode>";
   strXml += "<orderofevaluation>0</orderofevaluation>";
   strXml += "</wfparameter>";

   // Create the condition parameter
   string strParameterId= process.CreateConditionParameter(userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CreateCondition
  • CRMProcess Class
  • UpdateConditionParameter
  • Workflow Reference


CRMProcess.CreateRule Method

The CreateRule method creates a rule for a process step.

Syntax

[Visual Basic .NET]
Public Function CreateRule(
  ByVal Caller As CUserAuth,
  ByVal Rule As String
) As String
[C#]
public string CreateRule(
  CUserAuth  Caller,
  string  Rule
);
[C++]
public: String* CreateRule(
  CUserAuth*  Caller,
  String*  Rule
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateWorkflowProcess privilege to perform this action. See CUserAuth.
Rule
Specifies an XML string describing the rule. The XML schema is described by wfrule.xsd.

Return Value

Returns a String type that specifies the ID of the new rule.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId = "{72798DBF-7A8F-413B-AFEA-B85EF5363609}";

   // Set up the XML string for the strRule
   string strRuleXml = "<wfrule>";
   strRuleXml += "<stepid>" + strStepId + "</stepid>";
   strRuleXml += "<orderofevaluation>1</orderofevaluation>";
   strRuleXml += "</wfrule>";

   // Create the rule
   string strRuleId = process.CreateRule(userAuth, strRuleXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CreateAll
  • CRMProcess Class
  • UpdateRule
  • Workflow Reference


CRMProcess.CreateStep Method

The CreateStep method creates a step in a workflow process.

Syntax

[Visual Basic .NET]
Public Function CreateStep(
  ByVal Caller As CUserAuth,
  ByVal Step As String
) As String
[C#]
public string CreateStep(
  CUserAuth  Caller,
  string  Step
);
[C++]
public: String* CreateStep(
  CUserAuth*  Caller,
  String*  Step
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateWorkflowProcess privilege to perform this action. See CUserAuth.
Step
Specifies an XML string describing the step. The XML schema is described by wfstep.xsd.

Return Value

Returns a String type that specifies the ID of the new step.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
string strProcessId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the step
   string strStepXml = "<wfstep>";
   strStepXml += "<processid>" + strProcessId + "</processid>";
   strStepXml += "<name>Step 1</name>";
   strStepXml += "</wfstep>";

   // Create the step
   string strStepId = process.CreateStep(userAuth, strStepXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMProcess Class
  • UpdateStep
  • Workflow Reference


CRMProcess.Deactivate Method

The Deactivate method deactivates a workflow process, which prevents the process from being instantiated. Deactivating a process also allows the process to be edited.

Syntax

[Visual Basic .NET]
Public Sub Deactivate(
  ByVal Caller As CUserAuth,
  ByVal ProcessId As String
)
[C#]
public void Deactivate(
  CUserAuth  Caller,
  string  ProcessId
);
[C++]
public: void Deactivate(
  CUserAuth*  Caller,
  String*  ProcessId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcess privilege to perform this action. See CUserAuth.
ProcessId
Specifies the ID of the process that is to be deactivated.

Return Value

No return value.

Remarks

The process must have been activated before it can be deactivated.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

   // Deactivate the process
   process.Deactivate(userAuth, strProcessId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Workflow Reference


CRMProcess.Delete Method

The Delete method deletes a workflow process. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ProcessId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ProcessId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ProcessId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteWorkflowProcess privilege to perform this action. See CUserAuth.
ProcessId
Specifies the ID of the process that is to be deleted.

Return Value

No return value.

Remarks

To delete a process, you must first deactivate it. Deleting the process does not affect instances of the process that are already running.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

   // Delete the process
   process.Delete(userAuth, strProcessId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • DeleteAction
  • DeleteActionParameter
  • DeleteCondition
  • DeleteConditionParameter
  • DeleteRule
  • DeleteStep
  • CRMProcess Class
  • Workflow Reference


CRMProcess.DeleteAction Method

The DeleteAction method deletes an action for a process step. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub DeleteAction(
  ByVal Caller As CUserAuth,
  ByVal ActionId As String
)
[C#]
public void DeleteAction(
  CUserAuth  Caller,
  string  ActionId
);
[C++]
public: void DeleteAction(
  CUserAuth*  Caller,
  String*  ActionId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteWorkflowProcess privilege to perform this action. See CUserAuth.
ActionId
Specifies the ID of the action that is to be deleted.

Return Value

No return value.

Remarks

Before you delete an action, you must first remove all parameters that are associated with the action.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strActionId = "{13B74186-DB40-480F-AD31-F20432502F97}";

   // Delete the action
   process.DeleteAction(userAuth, strActionId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Delete
  • DeleteActionParameter
  • CRMProcess Class
  • Workflow Reference


CRMProcess.DeleteActionParameter Method

The DeleteActionParameter method deletes a parameter for an action.

Syntax

[Visual Basic .NET]
Public Sub DeleteActionParameter(
  ByVal Caller As CUserAuth,
  ByVal ParameterId As String
)
[C#]
public void DeleteActionParameter(
  CUserAuth  Caller,
  string  ParameterId
);
[C++]
public: void DeleteActionParameter(
  CUserAuth*  Caller,
  String*  ParameterId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteWorkflowProcess privilege to perform this action. See CUserAuth.
ParameterId
Specifies the ID of the parameter that is to be deleted

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strActionParamId = "{D9A55D5B-390B-4DAC-87C8-F38AD2169F38}";

   // Delete the action parameter
   process.DeleteActionParameter(userAuth, strActionParamId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Delete
  • DeleteAction
  • CRMProcess Class
  • Workflow Reference


CRMProcess.DeleteCondition Method

The DeleteCondition method deletes a condition for a rule. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub DeleteCondition(
  ByVal Caller As CUserAuth,
  ByVal ConditionId As String
)
[C#]
public void DeleteCondition(
  CUserAuth  Caller,
  string  ConditionId
);
[C++]
public: void DeleteCondition(
  CUserAuth*  Caller,
  String*  ConditionId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteWorkflowProcess privilege to perform this action. See CUserAuth.
ConditionId
Specifies the ID of the condition that is to be deleted.

Return Value

No return value.

Remarks

Before you delete a condition, you must first remove all parameters that are associated with the condition.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strConditionId = "{D9A55D5B-390B-4DAC-87C8-F38AD2169F38}";

   // Delete the condition
   process.DeleteCondition(userAuth, strConditionId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Delete
  • DeleteConditionParameter
  • CRMProcess Class
  • Workflow Reference


CRMProcess.DeleteConditionParameter Method

The DeleteConditionParameter method deletes a parameter for a condition.

Syntax

[Visual Basic .NET]
Public Sub DeleteConditionParameter(
  ByVal Caller As CUserAuth,
  ByVal ParameterId As String
)
[C#]
public void DeleteConditionParameter(
  CUserAuth  Caller,
  string  ParameterId
);
[C++]
public: void DeleteConditionParameter(
  CUserAuth*  Caller,
  String*  ParameterId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteWorkflowProcess privilege to perform this action. See CUserAuth.
ParameterId
Specifies the ID of the parameter that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strParamID = "{D9A55D5B-390B-4DAC-87C8-F38AD2169F38}";

   // Delete the condition parameter
   process.DeleteConditionParameter(userAuth, strParamID);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Delete
  • DeleteCondition
  • CRMProcess Class
  • Workflow Reference


CRMProcess.DeleteRule Method

The DeleteRule method deletes a rule for a process step.

Syntax

[Visual Basic .NET]
Public Sub DeleteRule(
  ByVal Caller As CUserAuth,
  ByVal RuleId As String
)
[C#]
public void DeleteRule(
  CUserAuth  Caller,
  string  RuleId
);
[C++]
public: void DeleteRule(
  CUserAuth*  Caller,
  String*  RuleId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteWorkflowProcess privilege to perform this action. See CUserAuth.
RuleId
Specifies the ID of the rule that is to be deleted.

Return Value

No return value.

Remarks

Before you delete a rule, you must first remove all conditions that are associated with the rule.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strRuleId = "{FC0C4939-7AD1-4BA8-B418-6D4D55459833}";

   // Delete the rule
   process.DeleteRule(userAuth, strRuleId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Delete
  • CRMProcess Class
  • Workflow Reference


CRMProcess.DeleteStep Method

The DeleteStep method deletes a step in a workflow process. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub DeleteStep(
  ByVal Caller As CUserAuth,
  ByVal StepId As String
)
[C#]
public void DeleteStep(
  CUserAuth  Caller,
  string  StepId
);
[C++]
public: void DeleteStep(
  CUserAuth*  Caller,
  String*  StepId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteWorkflowProcess privilege to perform this action. See CUserAuth.
StepId
Specifies the ID of the step that is to be deleted.

Return Value

No return value.

Remarks

Before you delete a step, you must first remove all actions and rules that are associated with the step.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId = "{72798DBF-7A8F-413B-AFEA-B85EF5363609}";

   // Delete the step
   process.DeleteStep(userAuth, strStepId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Delete
  • CRMProcess Class
  • Workflow Reference


CRMProcess.GetEntityByAttributeId Method

The GetEntityByAttributeId method retrieves the XML data for an object by the specified attribute ID. See Remarks.

Syntax

[Visual Basic .NET]
Public Function GetEntityByAttributeId(
  ByVal Caller As CUserAuth,
  ByVal AttributeId As String
) As String
[C#]
public string GetEntityByAttributeId(
  CUserAuth  Caller,
  string  AttributeId
);
[C++]
public: String* GetEntityByAttributeId(
  CUserAuth*  Caller,
  String*  AttributeId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
AttributeId
Specifies the ID of the attribute to find.

Return Value

Returns a String type that specifies the XML data containing the entity.

Remarks

Every object and field in Microsoft CRM is specified by a GUID. The object XML data that is returned by the GetEntityByAttributeId method contains the GUID for both the object (entityid) and each of its fields (attributeid). You can determine the attributeid for a particular field from this XML data for the object. The attributeid is a required field for WFPM_PROPERTY, WFPM_PROCESS, and WFPM_ACTION in the WORKFLOW_PARAMETER_TYPE class.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strAtributeId = "{E10A1960-6EEE-4A90-8348-9147FD923FC4}";

   // Get the entity
   string strEntity = process.GetEntityByAttributeId(userAuth, strAtributeId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Workflow Reference


CRMProcess.GetEntityByEntityId Method

The GetEntityByEntityId method retrieves the XML data for an object by its ID. See Remarks.

Syntax

[Visual Basic .NET]
Public Function GetEntityByEntityId(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String
) As String
[C#]
public string GetEntityByEntityId(
  CUserAuth  Caller,
  string  EntityId
);
[C++]
public: String* GetEntityByEntityId(
  CUserAuth*  Caller,
  String*  EntityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the object that is to be retrieved.

Return Value

Returns a String type that specifies the XML data containing the object.

Remarks

Every object and field in Microsoft CRM is specified by a GUID. The XML data that is returned by this method contains the GUID for both the object (entityid) and each of its fields (attributeid). You can determine the attributeid for a particular field from this XML data for the object. The attributeid is a required field for WFPM_PROPERTY, WFPM_PROCESS, and WFPM_ACTION in the WORKFLOW_PARAMETER_TYPE class.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strEntityId = "{B10AK960-6EEE-4A90-8348-9147FD923FC4}";

   // Get the entity
   string strEntityXml = process.GetEntityByAttributeId(userAuth, strEntityId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Workflow Reference


CRMProcess.GetEntityByName Method

The GetEntityByName method retrieves the XML data for an entity by its name. See Remarks.

Syntax

[Visual Basic .NET]
Public Function GetEntityByName(
  ByVal Caller As CUserAuth,
  ByVal EntityName As String,
  ByVal Mapping As Integer
) As String
[C#]
public string GetEntityByName(
  CUserAuth  Caller,
  string  EntityName,
  int  Mapping
);
[C++]
public: String* GetEntityByName(
  CUserAuth*  Caller,
  String*  EntityName,
  long  Mapping
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
EntityName
Specifies the name of the entity that is to be retrieved. For the list of entity names see the XML schema name column in ObjectTypes.
Mapping
Specifies the mapping. This parameter must be set to 1.

Return Value

Returns a String type that specifies the XML data containing the entity.

Remarks

Every entity and field in Microsoft CRM is specified by a GUID. The entity XML data that is returned by this method contains the GUID for both the entity (entityid) and each of its fields (attributeid). You can determine the attributeid for a particular field from this XML data for the entity. The attributeid is a required field for WFPM_PROPERTY, WFPM_PROCESS, and WFPM_ACTION in the WORKFLOW_PARAMETER_TYPE class.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Get the entity
   string strEntityXml = process.GetEntityByName(userAuth, "lead", 1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Workflow Reference


CRMProcess.GetEntityByObjectType Method

The GetEntityByObjectType method retrieves the XML data for an entity by its object type. See Remarks.

Syntax

[Visual Basic .NET]
Public Function GetEntityByObjectType(
  ByVal Caller As CUserAuth,
  ByVal ObjectType As Integer
) As String
[C#]
public string GetEntityByObjectType(
  CUserAuth  Caller,
  int  ObjectType
);
[C++]
public: String* GetEntityByObjectType(
  CUserAuth*  Caller,
  long  ObjectType
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
ObjectType
Specifies the type of the object that is to be retrieved. See ObjectType.

Return Value

Returns a String type that specifies the XML data containing the entity.

Remarks

Every entity and field in Microsoft CRM is specified by a GUID. The entity XML data that is returned by this method contains the GUID for both the entity (entityid) and each of its fields (attributeid). You can determine the attributeid for a particular field from this XML data for the entity. The attributeid is a required field for WFPM_PROPERTY, WFPM_PROCESS, and WFPM_ACTION in the WORKFLOW_PARAMETER_TYPE class.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Get the entity
   string strEntity = process.GetEntityByObjectType(userAuth, Microsoft.Crm.Platform.Types.ObjectType.otLead);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Workflow Reference


CRMProcess.Retrieve Method

The Retrieve method retrieves a workflow process.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal ProcessId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  ProcessId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  ProcessId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
ProcessId
Specifies the ID of the process that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfprocess.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the workflow process. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by wfprocess.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>processid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>priority</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the process
   string strProcessXml = process.Retrieve(userAuth, strProcessId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • RetrieveAction
  • RetrieveActionParameter
  • RetrieveActionParameters
  • RetrieveActions
  • RetrieveByCategory
  • RetrieveCondition
  • RetrieveConditionParameter
  • RetrieveConditionParameters
  • RetrieveLeftSteps
  • RetrieveRightSteps
  • RetrieveRule
  • RetrieveRuleConditions
  • RetrieveRules
  • RetrieveStep
  • RetrieveStepConditions
  • RetrieveSteps
  • Workflow Reference


CRMProcess.RetrieveAction Method

The RetrieveAction method retrieves the specified action for a process step.

Syntax

[Visual Basic .NET]
Public Function RetrieveAction(
  ByVal Caller As CUserAuth,
  ByVal ActionId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveAction(
  CUserAuth  Caller,
  string  ActionId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveAction(
  CUserAuth*  Caller,
  String*  ActionId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
ActionId
Specifies the ID of the action that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfaction.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the action. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by wfaction.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strActionId = "{13B74186-DB40-480F-AD31-F20432502F97}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>actionid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>stepid</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the action
   string strActionXml = process.RetrieveAction (userAuth, strActionId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveActionParameter
  • RetrieveActionParameters
  • RetrieveActions
  • Workflow Reference


CRMProcess.RetrieveActionParameter Method

The RetrieveActionParameter method retrieves the specified parameter for an action.

Syntax

[Visual Basic .NET]
Public Function RetrieveActionParameter(
  ByVal Caller As CUserAuth,
  ByVal ParameterId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveActionParameter(
  CUserAuth  Caller,
  string  ParameterId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveActionParameter(
  CUserAuth*  Caller,
  String*  ParameterId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
ParameterId
Specifies the ID of the parameter that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfparameter.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the parameter. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by wfparameter.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strParamId = "{D9A55D5B-390B-4DAC-87C8-F38AD2169F38}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>parameterid</column>";
   strColumnSetXml += "<column>parentid</column>";
   strColumnSetXml += "<column>conditionid</column>";
   strColumnSetXml += "<column>value</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the action parameter
   string strParamXml = process.RetrieveActionParameter(userAuth, strParamId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveAction
  • RetrieveActionParameters
  • RetrieveActions
  • Workflow Reference


CRMProcess.RetrieveActionParameters Method

The RetrieveActionParameters method retrieves all parameters for an action.

Syntax

[Visual Basic .NET]
Public Function RetrieveActionParameters(
  ByVal Caller As CUserAuth,
  ByVal ActionId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveActionParameters(
  CUserAuth  Caller,
  string  ActionId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveActionParameters(
  CUserAuth*  Caller,
  String*  ActionId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
ActionId
Specifies the ID of the action that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfparameter.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of parameters. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfparameters> + wfparameter1..N + </wfparameters>

where the XML schema for each parameter is described by wfparameter.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strActionId = "{13B74186-DB40-480F-AD31-F20432502F97}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>parameterid</column>";
   strColumnSetXml += "<column>parentid</column>";
   strColumnSetXml += "<column>conditionid</column>";
   strColumnSetXml += "<column>value</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the action parameters
   string strActionParamsXml = process.RetrieveActionParameters (userAuth, strActionId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveAction
  • RetrieveActionParameter
  • RetrieveActions
  • Workflow Reference


CRMProcess.RetrieveActions Method

The RetrieveActions method retrieves all actions for a process step.

Syntax

[Visual Basic .NET]
Public Function RetrieveActions(
  ByVal Caller As CUserAuth,
  ByVal StepId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveActions(
  CUserAuth  Caller,
  string  StepId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveActions(
  CUserAuth*  Caller,
  String*  StepId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
StepId
Specifies the ID of the step.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfaction.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of actions. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfactions> + wfaction1..N + </wfactions>

where the XML schema for each action is described by wfaction.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId = "{72798DBF-7A8F-413B-AFEA-B85EF5363609}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>actionid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the actions
   string strActionsXml = process.RetrieveActions (userAuth, strStepId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveAction
  • RetrieveActionParameter
  • RetrieveActionParameters
  • Workflow Reference


CRMProcess.RetrieveAll Method

The RetrieveAll method retrieves a workflow process and all of its sub-elements.

Syntax

[Visual Basic .NET]
Public Function RetrieveAll(
  ByVal Caller As CUserAuth,
  ByVal ProcessId As String
) As CWorkflowProcess
[C#]
public CWorkflowProcess RetrieveAll(
  CUserAuth  Caller,
  string  ProcessId
);
[C++]
public: CWorkflowProcess* RetrieveAll(
  CUserAuth*  Caller,
  String*  ProcessId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
ProcessId
Specifies the ID of the process that is to be retrieved.

Return Value

Returns a CWorkflowProcess type that stores a flat workflow process. See CWorkflowProcess.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
string strProcessId  = "{9B4CCEEC-AB41-4463-B3DF-F3C21CD9C6C3}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CWorkflowProcess  wfProcess = new Microsoft.Crm.Platform.Proxy.CWorkflowProcess();

   // Retrieve the process and its sub-elements
   wfProcess = process.RetrieveAll(userAuth, strProcessId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveRule
  • Workflow Reference


CRMProcess.RetrieveByCategory Method

The RetrieveByCategory method retrieves all processes for the specified object type. The caller must have read privileges for the specified object type.

Syntax

[Visual Basic .NET]
Public Function RetrieveByCategory(
  ByVal Caller As CUserAuth,
  ByVal ProcessType As WORKFLOW_PROCESS_TYPE,
  ByVal EntityType As ObjectType,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByCategory(
  CUserAuth  Caller,
  WORKFLOW_PROCESS_TYPE  ProcessType,
  ObjectType  EntityType,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByCategory(
  CUserAuth*  Caller,
  WORKFLOW_PROCESS_TYPE  ProcessType,
  ObjectType  EntityType,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
ProcessType
Specifies the process type. See WORKFLOW_PROCESS_TYPE.
EntityType
Specifies the type of the object. See ObjectType. Set EntityType to otNone to retrieve all processes.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfprocess.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing a list of workflow processes. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfprocesses> + wfprocess1..N + </wfprocesses>

where the XML schema for each process is described by wfprocess.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>eventtypecode</column>";
   strColumnSetXml += "<column>processtypecode</column>";
   strColumnSetXml += "</columnset>";

   string strResultsXml = process.RetrieveByCategory(userAuth, Microsoft.Crm.Platform.Proxy.WORKFLOW_PROCESS_TYPE.WFPT_WORKFLOW_PROCESS, Microsoft.Crm.Platform.Proxy.ObjectType.otActivity, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • Workflow Reference


CRMProcess.RetrieveCondition Method

The RetrieveCondition method retrieves a condition for a rule.

Syntax

[Visual Basic .NET]
Public Function RetrieveCondition(
  ByVal Caller As CUserAuth,
  ByVal ConditionId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveCondition(
  CUserAuth  Caller,
  string  ConditionId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveCondition(
  CUserAuth*  Caller,
  String*  ConditionId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
ConditionId
Specifies the ID of the condition that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfcondition.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the condition. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by wfcondition.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strConditionId = "{9A5D86F8-A678-414F-BB4D-FC170B3BA36B}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>ruleid</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the condition
   string strConditionXml = process.RetrieveCondition (userAuth, strConditionId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveConditionParameter
  • RetrieveConditionParameters
  • Workflow Reference


CRMProcess.RetrieveConditionParameter Method

The RetrieveConditionParameter method retrieves the specified parameter for a condition.

Syntax

[Visual Basic .NET]
Public Function RetrieveConditionParameter(
  ByVal Caller As CUserAuth,
  ByVal ParameterId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveConditionParameter(
  CUserAuth  Caller,
  string  ParameterId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveConditionParameter(
  CUserAuth*  Caller,
  String*  ParameterId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
ParameterId
Specifies the ID of the parameter that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfparameter.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the parameter. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by wfparameter.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strConditionParamId = "{9A5D86F8-A678-414F-BB4D-FC170B3BA36B}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>parentid</column>";
   strColumnSetXml += "<column>conditionid</column>";
   strColumnSetXml += "<column>parametertypecode</column>";
   strColumnSetXml += "<column>value</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the condition parameter
   string strConditionParamXml = process.RetrieveConditionParameter (userAuth, strConditionParamId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveCondition
  • RetrieveConditionParameters
  • Workflow Reference


CRMProcess.RetrieveConditionParameters Method

The RetrieveConditionParameters method retrieves all parameters for a condition.

Syntax

[Visual Basic .NET]
Public Function RetrieveConditionParameters(
  ByVal Caller As CUserAuth,
  ByVal ConditionId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveConditionParameters(
  CUserAuth  Caller,
  string  ConditionId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveConditionParameters(
  CUserAuth*  Caller,
  String*  ConditionId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
ConditionId
Specifies the ID of the condition.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfparameter.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of parameters associated with the specified condition. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfparameters> + wfparameter1..N + </wfparameters>

where the XML schema for each parameter is described by wfparameter.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strConditionId = "{9A5D86F8-A678-414F-BB4D-FC170B3BA36B}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>parentid</column>";
   strColumnSetXml += "<column>conditionid</column>";
   strColumnSetXml += "<column>parametertypecode</column>";
   strColumnSetXml += "<column>value</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the condition parameters
   string strConditionParamXml = process.RetrieveConditionParameters (userAuth, strConditionId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveCondition
  • RetrieveConditionParameter
  • Workflow Reference


CRMProcess.RetrieveLeftSteps Method

The RetrieveLeftSteps method retrieves all of the steps that precede the specified step.

Syntax

[Visual Basic .NET]
Public Function RetrieveLeftSteps(
  ByVal Caller As CUserAuth,
  ByVal StepId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveLeftSteps(
  CUserAuth  Caller,
  string  StepId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveLeftSteps(
  CUserAuth*  Caller,
  String*  StepId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
StepId
Specifies the ID of the step that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. The field description cannot be included in the column set, and the parameter cannot be null. You can find the valid column names in wfstep.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of steps that precede the specified step. The field description cannot be included in the column set, and the parameter cannot be null. This XML string is in the format

<wfsteps> + wfstep1..N + </wfsteps>

where the XML schema for each step is described by wfstep.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId = "{72798DBF-7A8F-413B-AFEA-B85EF5363609}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>processid</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the left steps
   string strStepsXml = process.RetrieveLeftSteps(userAuth, strStepId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • Workflow Reference


CRMProcess.RetrieveRightSteps Method

The RetrieveRightSteps method retrieves all of the steps that follow the specified step.

Syntax

[Visual Basic .NET]
Public Function RetrieveRightSteps(
  ByVal Caller As CUserAuth,
  ByVal StepId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveRightSteps(
  CUserAuth  Caller,
  string  StepId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveRightSteps(
  CUserAuth*  Caller,
  String*  StepId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
StepId
Specifies the ID of the step.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. The field description cannot be included in the column set, and the parameter cannot be null. You can find the valid column names in wfstep.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of steps that follow the specified step. The field description cannot be included in the column set, and the parameter cannot be null. This XML string is in the format

<wfsteps> + wfstep1..N + </wfsteps>

where the XML schema for each step is described by wfstep.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId = "{72798DBF-7A8F-413B-AFEA-B85EF5363609}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>processid</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the right steps
   string strStepsXml = process.RetrieveRightSteps (userAuth, strStepId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • Workflow Reference


CRMProcess.RetrieveRule Method

The RetrieveRule method retrieves the specified rule for a process step.

Syntax

[Visual Basic .NET]
Public Function RetrieveRule(
  ByVal Caller As CUserAuth,
  ByVal RuleId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveRule(
  CUserAuth  Caller,
  string  RuleId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveRule(
  CUserAuth*  Caller,
  String*  RuleId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
RuleId
Specifies the ID of the rule that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfrule.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the rule. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by wfrule.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strRuleId = "{FC0C4939-7AD1-4BA8-B418-6D4D55459833}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>stepid</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the rule
   string strRuleXml = process.RetrieveRule(userAuth, strRuleId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveAll
  • RetrieveRuleConditions
  • RetrieveRules
  • Workflow Reference


CRMProcess.RetrieveRuleConditions Method

The RetrieveRuleConditions method retrieves all conditions for a rule.

Syntax

[Visual Basic .NET]
Public Function RetrieveRuleConditions(
  ByVal Caller As CUserAuth,
  ByVal RuleId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveRuleConditions(
  CUserAuth  Caller,
  string  RuleId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveRuleConditions(
  CUserAuth*  Caller,
  String*  RuleId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
RuleId
Specifies the ID of the rule.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfcondition.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of conditions associated with the specified rule. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfconditions> + wfcondition1..N + </wfconditions>

where the XML schema for each condition is described by wfcondition.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strRuleId = "{FC0C4939-7AD1-4BA8-B418-6D4D55459833}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>conditiontypecode</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the rule conditions
   string strRuleConditionsXml = process.RetrieveRuleConditions(userAuth, strRuleId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveRule
  • RetrieveRules
  • Workflow Reference


CRMProcess.RetrieveRules Method

The RetrieveRules method retrieves all rules for a process step.

Syntax

[Visual Basic .NET]
Public Function RetrieveRules(
  ByVal Caller As CUserAuth,
  ByVal StepId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveRules(
  CUserAuth  Caller,
  string  StepId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveRules(
  CUserAuth*  Caller,
  String*  StepId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
StepId
Specifies the ID of the step.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfrule.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of rules associated with the specified step. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfrules> + wfrule1..N + </wfrules>

where the XML schema for each rule is described by wfrule.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId = "{72798DBF-7A8F-413B-AFEA-B85EF5363609}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>stepid</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the rules
   string strRulesXml = process.RetrieveRules(userAuth, strStepId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveRule
  • RetrieveRuleConditions
  • Workflow Reference


CRMProcess.RetrieveStep Method

The RetrieveStep method retrieves the specified step in a workflow process.

Syntax

[Visual Basic .NET]
Public Function RetrieveStep(
  ByVal Caller As CUserAuth,
  ByVal StepId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveStep(
  CUserAuth  Caller,
  string  StepId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveStep(
  CUserAuth*  Caller,
  String*  StepId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
StepId
Specifies the ID of the step that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfstep.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the step. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by wfstep.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId = "{72798DBF-7A8F-413B-AFEA-B85EF5363609}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>stepid</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the step
   string strStepXml = process.RetrieveStep(userAuth, strStepId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveStepConditions
  • RetrieveSteps
  • Workflow Reference


CRMProcess.RetrieveStepConditions Method

The RetrieveStepConditions method retrieves all conditions for a step.

Syntax

[Visual Basic .NET]
Public Function RetrieveStepConditions(
  ByVal Caller As CUserAuth,
  ByVal StepId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveStepConditions(
  CUserAuth  Caller,
  string  StepId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveStepConditions(
  CUserAuth*  Caller,
  String*  StepId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
StepId
Specifies the ID of the step.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfcondition.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of conditions associated with the specified step. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfconditions> + wfcondition1..N + </wfconditions>

where the XML schema for each condition is described by wfcondition.xsd.

Remarks

This function retrieves all of the conditions that are associated with one of the rules of the specified step. The column ruleid is always included in the result.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId = "{72798DBF-7A8F-413B-AFEA-B85EF5363609}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>conditiontypecode</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the step conditions
   string strStepConditionsXml = process.RetrieveStepConditions (userAuth, strStepId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveStep
  • RetrieveSteps
  • Workflow Reference


CRMProcess.RetrieveSteps Method

The RetrieveSteps method retrieves all steps of a process.

Syntax

[Visual Basic .NET]
Public Function RetrieveSteps(
  ByVal Caller As CUserAuth,
  ByVal ProcessId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveSteps(
  CUserAuth  Caller,
  string  ProcessId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveSteps(
  CUserAuth*  Caller,
  String*  ProcessId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcess privilege to perform this action. See CUserAuth.
ProcessId
Specifies the ID of the process.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfstep.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of steps associated with the specified process. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfsteps> + wfstep1..N + </wfsteps>

where the XML schema for each step is described by wfstep.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>stepid</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the steps
   string strStepsXml = process.RetrieveSteps(userAuth, strProcessId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcess Class
  • Retrieve
  • RetrieveStep
  • RetrieveStepConditions
  • Workflow Reference


CRMProcess.Update Method

The Update method updates a workflow process.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal ProcessId As String,
  ByVal Process As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  ProcessId,
  string  Process
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  ProcessId,
  String*  Process
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcess privilege to perform this action. See CUserAuth.
ProcessId
Specifies the ID of the process that is to be updated.
Process
Specifies an XML string describing the workflow process. The XML schema is described by wfprocess.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

   // Set up the XML string for the process
   string strXml = "<wfprocess>";
   strXml += "<name>My lead policy</name>";
   strXml += "<description>new lead policy of Adventure Works</description>";
   strXml += "<usercontext>" + userAuth.UserId + "</usercontext>";
   strXml += "<businessunitid>" + userAuth.MerchantId + "</businessunitid>";
   strXml += "</wfprocess>";

   // Update the process
   process.Update( userAuth, strProcessId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMProcess Class
  • UpdateAction
  • UpdateActionParameter
  • UpdateAll
  • UpdateAndRetrieve
  • UpdateCondition
  • UpdateConditionParameter
  • UpdateRule
  • UpdateStep
  • Workflow Reference


CRMProcess.UpdateAction Method

The UpdateAction method updates an action for a process step.

Syntax

[Visual Basic .NET]
Public Sub UpdateAction(
  ByVal Caller As CUserAuth,
  ByVal ActionId As String,
  ByVal Action As String
)
[C#]
public void UpdateAction(
  CUserAuth  Caller,
  string  ActionId,
  string  Action
);
[C++]
public: void UpdateAction(
  CUserAuth*  Caller,
  String*  ActionId,
  String*  Action
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcess privilege to perform this action. See CUserAuth.
ActionId
Specifies the ID of the action that is to be updated.
Action
Specifies an XML string describing the action. The XML schema is described by wfaction.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId = "{72798DBF-7A8F-413B-AFEA-B85EF5363609}";
   string strActionId = "{13B74186-DB40-480F-AD31-F20432502F97}";

   string strActionXml = "<wfaction>";
   strActionXml += "<stepid>" + strStepId + "</stepid>";
   strActionXml += "<actiontypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_ACTION_TYPE.WFAT_ASSIGN.ToString() + "</actiontypecode>";
   strActionXml += "</wfaction>";

   // Update the action
   process.UpdateAction(userAuth,strActionId,strActionXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAction
  • CRMProcess Class
  • Update
  • UpdateActionParameter
  • Workflow Reference


CRMProcess.UpdateActionParameter Method

The UpdateActionParameter method updates an action parameter.

Syntax

[Visual Basic .NET]
Public Sub UpdateActionParameter(
  ByVal Caller As CUserAuth,
  ByVal ParameterId As String,
  ByVal Parameter As String
)
[C#]
public void UpdateActionParameter(
  CUserAuth  Caller,
  string  ParameterId,
  string  Parameter
);
[C++]
public: void UpdateActionParameter(
  CUserAuth*  Caller,
  String*  ParameterId,
  String*  Parameter
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcess privilege to perform this action. See CUserAuth.
ParameterId
Specifies the ID of the parameter that is to be updated.
Parameter
Specifies an XML string describing the parameter. The XML schema is described by wfparameter.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strParameterId = "{D9A55D5B-390B-4DAC-87C8-F38AD2169F38}";

   // Set up the XML string for the action
   string strXml = "<wfparameter>";
   strXml += "<parametertypecode>" + Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_DATE.ToString() + "</parametertypecode>";
   strXml += "</wfparameter>";

   // Update the action parameter
   process.UpdateActionParameter(userAuth, strParameterId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateActionParameter
  • CRMProcess Class
  • Update
  • UpdateAction
  • Workflow Reference


CRMProcess.UpdateAll Method

The UpdateAll method updates (overwrites) a workflow process and all of its sub-elements.

Syntax

[Visual Basic .NET]
Public Sub UpdateAll(
  ByVal Caller As CUserAuth,
  ByVal ProcessId As String,
  ByVal Process As CWorkflowProcess
)
[C#]
public void UpdateAll(
  CUserAuth  Caller,
  string  ProcessId,
  CWorkflowProcess  Process
);
[C++]
public: void UpdateAll(
  CUserAuth*  Caller,
  String*  ProcessId,
  CWorkflowProcess*  Process
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcess privilege to perform this action. See CUserAuth.
ProcessId
Specifies the ID of the process that is to be updated.
Process
Specifies a CWorkflowProcess structure that stores a flat workflow process. See CWorkflowProcess.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
string strProcessId = "{9B4CCEEC-AB41-4463-B3DF-F3C21CD9C6C3}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CWorkflowProcess  wfProcess = new Microsoft.Crm.Platform.Proxy.CWorkflowProcess();

   // Set up the XML string to update the process and all of its elements
   wfProcess.Steps = "<wfsteps><wfstep><name>" + "My Step Name" + "</name>description>" + "A description of my step" + "</description></wfstep></wfsteps>";
   wfProcess.ActionParameters = "<wfparameters></wfparameters>";
   wfProcess.Actions = "<wfactions></wfactions>";
   wfProcess.ConditionParameters = "<wfparameters></wfparameters>";
   wfProcess.Conditions = "<wfconditions><wfcondition><name>" + "My Condition Name" + "</name></wfcondition></wfconditions>";

   // Update the process and all of its elements
   process.UpdateAll (userAuth, strProcessId, wfProcess);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAll
  • CRMProcess Class
  • Update
  • UpdateRule
  • Workflow Reference


CRMProcess.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a workflow process and then returns it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ProcessId As String,
  ByVal InProcessXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  ProcessId,
  string  InProcessXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  ProcessId,
  String*  InProcessXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcess and prvReadWorkflowProcess privileges to perform this action. See CUserAuth.
ProcessId
Specifies the ID of the process that is to be updated.
InProcessXML
Specifies an XML string describing the workflow process. The XML schema is described by wfprocess.xsd.

Return Value

Returns a String type that specifies the XML data containing the updated workflow process. The XML schema is described by wfprocess.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

   // Set up the XML string for the process;
   string strXml = "<wfprocess>";
   strXml += " <name>lead policy 1</name>";
   strXml += " <description>new lead policy of Adventure Works</description>";
   strXml += " <usercontext>" + userAuth.UserId + "</usercontext>";
   strXml += " <businessunitid>" + userAuth.MerchantId + "</businessunitid>";
   strXml += " </wfprocess>";

   // Update the process
   string strProcessXml = process.UpdateAndRetrieve( userAuth, strProcessId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMProcess Class
  • Update
  • Workflow Reference


CRMProcess.UpdateCondition Method

The UpdateCondition method updates a condition for a rule.

Syntax

[Visual Basic .NET]
Public Sub UpdateCondition(
  ByVal Caller As CUserAuth,
  ByVal ConditionId As String,
  ByVal Condition As String
)
[C#]
public void UpdateCondition(
  CUserAuth  Caller,
  string  ConditionId,
  string  Condition
);
[C++]
public: void UpdateCondition(
  CUserAuth*  Caller,
  String*  ConditionId,
  String*  Condition
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcess privilege to perform this action. See CUserAuth.
ConditionId
Specifies the ID of the condition that is to be updated.
Condition
Specifies an XML string describing the condition. The XML schema is described by wfcondition.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strConditionId = "{9A5D86F8-A678-414F-BB4D-FC170B3BA36B}";

   // Set up the XML string for the condition
   string strConditionXml = "<wfcondition>";
   // For condition type, code is user defined
   strConditionXml += "<conditiontypecode>4</conditiontypecode>";
   strConditionXml += "</wfcondition>";

   // Update the condition
   process.UpdateCondition (userAuth, strConditionId, strConditionXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateCondition
  • CRMProcess Class
  • Update
  • UpdateConditionParameter
  • Workflow Reference


CRMProcess.UpdateConditionParameter Method

The UpdateConditionParameter method updates a condition parameter.

Syntax

[Visual Basic .NET]
Public Sub UpdateConditionParameter(
  ByVal Caller As CUserAuth,
  ByVal ParameterId As String,
  ByVal Parameter As String
)
[C#]
public void UpdateConditionParameter(
  CUserAuth  Caller,
  string  ParameterId,
  string  Parameter
);
[C++]
public: void UpdateConditionParameter(
  CUserAuth*  Caller,
  String*  ParameterId,
  String*  Parameter
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcess privilege to perform this action. See CUserAuth.
ParameterId
Specifies the ID of the parameter that is to be updated.
Parameter
Specifies an XML string describing the parameter. The XML schema is described by wfparameter.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strParameterId = "{D9A55D5B-390B-4DAC-87C8-F38AD2169F38}";

   int pcode = Microsoft.Crm.Platform.Types.WORKFLOW_PARAMETER_TYPE.WFPM_ACTION.ToString();

   string strXml = "<wfparameter>";
   strXml += "<parametertypecode>" + pcode + "</parametertypecode>";
   strXml += "<orderofevaluation>1</orderofevaluation>";
   strXml += "</wfparameter>";

   // Update the condition parameter
   process.UpdateConditionParameter( userAuth, strParameterId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateConditionParameter
  • CRMProcess Class
  • Update
  • UpdateCondition
  • Workflow Reference


CRMProcess.UpdateRule Method

The UpdateRule method updates a rule for a process step.

Syntax

[Visual Basic .NET]
Public Sub UpdateRule(
  ByVal Caller As CUserAuth,
  ByVal RuleId As String,
  ByVal Rule As String
)
[C#]
public void UpdateRule(
  CUserAuth  Caller,
  string  RuleId,
  string  Rule
);
[C++]
public: void UpdateRule(
  CUserAuth*  Caller,
  String*  RuleId,
  String*  Rule
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcess privilege to perform this action. See CUserAuth.
RuleId
Specifies the ID of the rule that is to be updated.
Rule
Specifies an XML string describing the rule. The XML schema is described by wfrule.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strRuleId = "{FC0C4939-7AD1-4BA8-B418-6D4D55459833}";

   // Set up the XML string for the rule
   string strRuleXml = "<wfrule>";
   strRuleXml += "<orderofevaluation>1</orderofevaluation>";
   strRuleXml += "<name>name 1</name>";
   strRuleXml += "</wfrule>";

   // Update the rule
   process.UpdateRule(userAuth, strRuleId, strRuleXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateRule
  • CRMProcess Class
  • Update
  • UpdateAll
  • Workflow Reference


CRMProcess.UpdateStep Method

The UpdateStep method updates a step in a workflow process.

Syntax

[Visual Basic .NET]
Public Sub UpdateStep(
  ByVal Caller As CUserAuth,
  ByVal StepId As String,
  ByVal Step As String
)
[C#]
public void UpdateStep(
  CUserAuth  Caller,
  string  StepId,
  string  Step
);
[C++]
public: void UpdateStep(
  CUserAuth*  Caller,
  String*  StepId,
  String*  Step
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcess privilege to perform this action. See CUserAuth.
StepId
Specifies the ID of the step that is to be updated.
Step
Specifies an XML string describing the step. The XML schema is described by wfstep.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcess proxy object
Microsoft.Crm.Platform.Proxy.CRMProcess  process = new Microsoft.Crm.Platform.Proxy.CRMProcess();
process.Credentials = System.Net.CredentialCache.DefaultCredentials;
process.Url = strDir + "CRMProcess.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

   // Set up the XML string for the step
   string strStepXml = "<wfstep>";
   strStepXml += "<name>Step 2</name>";
   strStepXml += "</wfstep>";

   // Update the step
   process.UpdateStep(userAuth, strStepId, strStepXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateStep
  • CRMProcess Class
  • Update
  • Workflow Reference


CRMProcessController Class

The CRMProcessController class contains methods that you can use to manage workflow process instance objects.

Note Workflow processes that are created by using the methods in the CRMProcess class and CRMProcessController class do not display any details in the Microsoft CRM Workflow Manager and Workflow Monitor tools. You can see the line items for your custom processes in these tools, but the detail windows are empty.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMProcessController
[Visual Basic .NET]
Public Class CRMProcessController
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMProcessController : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMProcessController: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMProcessController class exposes the following methods.

Method | Description
Delete | Deletes a completed process instance and all of its logs.
Execute | Executes a process manually.
IsObjectInProcess | Checks whether an object is currently in an active process instance.
Pause | Pauses the execution of a process instance.
Resume | Resumes the execution of a process instance.
RetrieveActionLog | Retrieves the action log of a process instance.
RetrieveCompletedSteps | Retrieves all of the completed steps.
RetrieveProcessesByObject | Retrieves all of the workflow processes that can be run by an object.
RetrieveProcessInstance | Retrieves a workflow process instance.
RetrieveProcessInstancesByCategory | Retrieves workflow process instances by category.
RetrieveProcessInstancesByObject | Retrieves workflow process instances that are associated with a specified object.
RetrieveProcessInstancesSummary | Retrieves a summary of the process instances.
RetrieveRightSteps | Retrieves all of the steps that follow a specified step.
RetrieveRuleLog | Retrieves the rule log of a process instance.
RetrieveSalesProcessActivities | Retrieves all sales process activities and their states for an opportunity.
RetrieveSalesProcessStages | Retrieves the stages for an opportunity if that opportunity is in a sales process.
RetrieveStepActions | Retrieves all of the actions that are defined for process step.
SetStep | Sets a step of a process instance manually.
Terminate | Terminates a process instance manually.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMProcessController.Delete Method

The Delete method deletes a completed process instance and all of its logs.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ProcessInstanceId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ProcessInstanceId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ProcessInstanceId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteWorkflowProcessInstance privilege to perform this action. See CUserAuth.
ProcessInstanceId
Specifies the ID of the process instance that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessInstanceId = "{A8CB383D-C9F2-2344-34KE-4A59F7569432}";

   // Delete the process instance
   processcontroller.Delete (userAuth, strProcessInstanceId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.Execute Method

The Execute method executes a process manually.

Syntax

[Visual Basic .NET]
Public Function Execute(
  ByVal Caller As CUserAuth,
  ByVal ProcessId As String,
  ByVal Object As CObjectName,
  ByVal Params As String
) As String
[C#]
public string Execute(
  CUserAuth  Caller,
  string  ProcessId,
  CObjectName  Object,
  string  Params
);
[C++]
public: String* Execute(
  CUserAuth*  Caller,
  String*  ProcessId,
  CObjectName*  Object,
  String*  Params
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
ProcessId
Specifies the ID of the process that is to be executed.
Object
Specifies the object on which the workflow process is to be run. See CObjectName.
Params
[Not supported in this version; reserved for future use.]

Return Value

Returns a String type that specifies the new process instance ID.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessId = "{B2BB383D-C9F2-4235-98DE-4A59F7569432}";
   string strLeadId = "{4AAD6AD1-244C-4270-86A2-046BF3CAC92F}";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strLeadId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otLead;

   // Create the process
   // The process should be activate to execute the process
   string strInstanceId = processcontroller.Execute(userAuth, strProcessId, objName, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.IsObjectInProcess Method

The IsObjectInProcess method checks whether an object is currently in an active process instance.

Syntax

[Visual Basic .NET]
Public Function IsObjectInProcess(
  ByVal Caller As CUserAuth,
  ByVal ProcessType As WORKFLOW_PROCESS_TYPE,
  ByVal Object As CObjectName
) As Integer
[C#]
public int IsObjectInProcess(
  CUserAuth  Caller,
  WORKFLOW_PROCESS_TYPE  ProcessType,
  CObjectName  Object
);
[C++]
public: long IsObjectInProcess(
  CUserAuth*  Caller,
  WORKFLOW_PROCESS_TYPE  ProcessType,
  CObjectName*  Object
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
WORKFLOW_PROCESS_TYPE
Specifies the process type. See WORKFLOW_PROCESS_TYPE.
Object
Specifies the object. See CObjectName.

Return Value

Returns an Int32 type that specifies true (non-zero) or false (zero).

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strLeadId = "{4AAD6AD1-244C-4270-86A2-046BF3CAC92F}";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strLeadId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otLead;

   int flag = processcontroller.IsObjectInProcess (userAuth, Microsoft.Crm.Platform.Proxy.WORKFLOW_PROCESS_TYPE.WFPT_WORKFLOW_PROCESS, objName);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.Pause Method

The Pause method pauses the execution of a process instance.

Syntax

[Visual Basic .NET]
Public Sub Pause(
  ByVal Caller As CUserAuth,
  ByVal ProcessInstanceId As String
)
[C#]
public void Pause(
  CUserAuth  Caller,
  string  ProcessInstanceId
);
[C++]
public: void Pause(
  CUserAuth*  Caller,
  String*  ProcessInstanceId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcessInstance privilege to perform this action. See CUserAuth.
ProcessInstanceId
Specifies the ID of the process instance that is to be paused.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessInstanceId = "{A8CB383D-C9F2-2344-34KE-4A59F7569432}";

   // Pause the process
   processcontroller.Pause(userAuth, strProcessInstanceId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.Resume Method

The Resume method resumes the execution of a process instance.

Syntax

[Visual Basic .NET]
Public Sub Resume(
  ByVal Caller As CUserAuth,
  ByVal ProcessInstanceId As String
)
[C#]
public void Resume(
  CUserAuth  Caller,
  string  ProcessInstanceId
);
[C++]
public: void Resume(
  CUserAuth*  Caller,
  String*  ProcessInstanceId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcessInstance privilege to perform this action. See CUserAuth.
ProcessInstanceId
Specifies the ID of the process instance that is to be resumed.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessInstanceId = "{A8CB383D-C9F2-2344-34KE-4A59F7569432}";

   // Pause the process
   processcontroller.Pause(userAuth, strProcessInstanceId);

   // Resume the process
   processcontroller.Resume(userAuth, strProcessInstanceId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.RetrieveActionLog Method

The RetrieveActionLog method retrieves the action log of a process instance.

Syntax

[Visual Basic .NET]
Public Function RetrieveActionLog(
  ByVal Caller As CUserAuth,
  ByVal ProcessInstanceId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveActionLog(
  CUserAuth  Caller,
  string  ProcessInstanceId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveActionLog(
  CUserAuth*  Caller,
  String*  ProcessInstanceId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
ProcessInstanceId
Specifies the ID of the process instance that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfactionlog.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the action log. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by wfactionlog.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessInstanceId = "{A8CB383D-C9F2-2344-34KE-4A59F7569432}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>status</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>value</column>";
   strColumnSetXml += "</columnset>";

   string strActionLogXml = processcontroller.RetrieveActionLog (userAuth, strProcessInstanceId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.RetrieveCompletedSteps Method

The RetrieveCompletedSteps method retrieves all of the completed steps.

Syntax

[Visual Basic .NET]
Public Function RetrieveCompletedSteps(
  ByVal Caller As CUserAuth,
  ByVal ProcessInstanceId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveCompletedSteps(
  CUserAuth  Caller,
  string  ProcessInstanceId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveCompletedSteps(
  CUserAuth*  Caller,
  String*  ProcessInstanceId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
ProcessInstanceId
Specifies the ID of the process instance that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfstep.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of steps. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfsteps> + wfstep1..N + </wfsteps>

where the XML schema for each step is described by wfstep.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessInstanceId = "{A8CB383D-C9F2-2344-34KE-4A59F7569432}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>stepcode</column>";
   strColumnSetXml += "</columnset>";

   string strStepsXml = processcontroller.RetrieveCompletedSteps (userAuth, strProcessInstanceId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.RetrieveProcessesByObject Method

The RetrieveProcessesByObject method retrieves all of the workflow processes that can be run by an object.

Syntax

[Visual Basic .NET]
Public Function RetrieveProcessesByObject(
  ByVal Caller As CUserAuth,
  ByVal ProcessType As WORKFLOW_PROCESS_TYPE,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveProcessesByObject(
  CUserAuth  Caller,
  WORKFLOW_PROCESS_TYPE  ProcessType,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveProcessesByObject(
  CUserAuth*  Caller,
  WORKFLOW_PROCESS_TYPE  ProcessType,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
WORKFLOW_PROCESS_TYPE
Specifies the process type. See WORKFLOW_PROCESS_TYPE.
Object
Specifies the object to find. See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfprocess.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of processes. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfprocesses> + wfprocess1..N + </wfprocesses>

where the XML schema for each process is described by wfprocess.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strLeadId = "{4AAD6AD1-244C-4270-86A2-046BF3CAC92F}";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strLeadId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otLead;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>priority</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>processid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve by object
   string strProcessXml = processcontroller.RetrieveProcessesByObject (userAuth, Microsoft.Crm.Platform.Proxy.WORKFLOW_PROCESS_TYPE.WFPT_WORKFLOW_PROCESS, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.RetrieveProcessInstance Method

The RetrieveProcessInstance method retrieves a workflow process instance.

Syntax

[Visual Basic .NET]
Public Function RetrieveProcessInstance(
  ByVal Caller As CUserAuth,
  ByVal ProcessInstanceId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveProcessInstance(
  CUserAuth  Caller,
  string  ProcessInstanceId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveProcessInstance(
  CUserAuth*  Caller,
  String*  ProcessInstanceId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
ProcessInstanceId
Specifies the ID of the process instance that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfprocessinstance.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the process instance. The XML schema is described by wfprocessinstance.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessInstanceId = "{A8CB383D-C9F2-2344-34KE-4A59F7569432}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>processid</column>";
   strColumnSetXml += "<column>parentid</column>";
   strColumnSetXml += "<column>objectid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the process instance information
   string strResultsXml = processcontroller.RetrieveProcessInstance (userAuth, strProcessInstanceId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • RetrieveProcessInstancesByCategory
  • RetrieveProcessInstancesByObject
  • Workflow Reference


CRMProcessController.RetrieveProcessInstancesByCategory Method

The RetrieveProcessInstancesByCategory method retrieves workflow process instances by category.

Syntax

[Visual Basic .NET]
Public Function RetrieveProcessInstancesByCategory(
  ByVal Caller As CUserAuth,
  ByVal EntityType As ObjectType,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveProcessInstancesByCategory(
  CUserAuth  Caller,
  ObjectType  EntityType,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveProcessInstancesByCategory(
  CUserAuth*  Caller,
  ObjectType  EntityType,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
EntityType
Specifies the type of the object to find. See ObjectType. Set the object type to otNone to retrieve all the process instances.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfprocessinstance.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of process instances associated with the specified category. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfprocessinstances> + wfprocessinstance1..N + </wfprocessinstances>

where the XML schema for each process instance is described by wfprocessinstance.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>parentid</column>";
   strColumnSetXml += "<column>processid</column>";
   strColumnSetXml += "<column>objectid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the process instance
   string strResultsXml = processcontroller.RetrieveProcessInstancesByCategory (userAuth, Microsoft.Crm.Platform.Proxy.ObjectType.otLead, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • RetrieveProcessInstance
  • Workflow Reference


CRMProcessController.RetrieveProcessInstancesByObject Method

The RetrieveProcessInstancesByObject method retrieves workflow process instances that are associated with a specified object.

Syntax

[Visual Basic .NET]
Public Function RetrieveProcessInstancesByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveProcessInstancesByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveProcessInstancesByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
Object
Specifies the object associated with a process instance. See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfprocessinstance.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of process instances associated with the specified object. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfprocessinstances> + wfprocessinstance1..N + </wfprocessinstances>

where the XML schema for each process instance is described by wfprocessinstance.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strLeadId = "{4AAD6AD1-244C-4270-86A2-046BF3CAC92F}";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strLeadId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otLead;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>processid</column>";
   strColumnSetXml += "<column>parentid</column>";
   strColumnSetXml += "<column>objectid</column>";
   strColumnSetXml += "</columnset>";

   string strResultsXml = processcontroller.RetrieveProcessInstancesByObject (userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • RetrieveProcessInstance
  • Workflow Reference


CRMProcessController.RetrieveProcessInstancesSummary Method

The RetrieveProcessInstancesSummary method retrieves a summary of the process instances. The workflow summary is the result of an aggregate query and returns an array of summaries that group the process instances by objecttype and statecode.

Syntax

[Visual Basic .NET]
Public Function RetrieveProcessInstancesSummary(
  ByVal Caller As CUserAuth
) As CWorkflowSummary()
[C#]
public CWorkflowSummary[] RetrieveProcessInstancesSummary(
  CUserAuth  Caller
);
[C++]
public: CWorkflowSummary* RetrieveProcessInstancesSummary(
  CUserAuth*  Caller
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.

Return Value

Returns a CWorkflowSummary[] type that specifies an array of summaries. See CWorkflowSummary.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();
   Microsoft.Crm.Platform.Proxy.CWorkflowSummary[] summary;

   // Retrieve the process instance summary
   summary = processcontroller.RetrieveProcessInstancesSummary(userAuth);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • RetrieveProcessInstance
  • Workflow Reference


CRMProcessController.RetrieveRightSteps Method

The RetrieveRightSteps method retrieves all of the steps that follow a specified step.

Syntax

[Visual Basic .NET]
Public Function RetrieveRightSteps(
  ByVal Caller As CUserAuth,
  ByVal StepId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveRightSteps(
  CUserAuth  Caller,
  string  StepId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveRightSteps(
  CUserAuth*  Caller,
  String*  StepId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
StepId
Specifies the ID of the step that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfstep.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the step. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfsteps> + wfstep1..N + </wfsteps>

where the XML schema for each step is described by wfstep.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId= "{4AAD6AD1-244C-4270-86A2-046BF3CAC92F}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>processid</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the right steps
   string strResultsXml = processcontroller.RetrieveRightSteps (userAuth, strStepId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.RetrieveRuleLog Method

The RetrieveRuleLog method retrieves the rule log of a process instance.

Syntax

[Visual Basic .NET]
Public Function RetrieveRuleLog(
  ByVal Caller As CUserAuth,
  ByVal ProcessInstanceId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveRuleLog(
  CUserAuth  Caller,
  string  ProcessInstanceId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveRuleLog(
  CUserAuth*  Caller,
  String*  ProcessInstanceId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
ProcessInstanceId
Specifies the ID of the process instance.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfrulelog.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the rule log. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by wfrulelog.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessInstanceId = "{A8CB383D-C9F2-2344-34KE-4A59F7569432}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>time</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>status</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the rule log
   string strResultsXml = processcontroller.RetrieveRuleLog(userAuth, strProcessInstanceId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.RetrieveSalesProcessActivities Method

The RetrieveSalesProcessActivities method retrieves all sales process activities and their states for an opportunity.

Syntax

[Visual Basic .NET]
Public Function RetrieveSalesProcessActivities(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName
) As CSalesProcessActivity()
[C#]
public CSalesProcessActivity[] RetrieveSalesProcessActivities(
  CUserAuth  Caller,
  CObjectName  Object
);
[C++]
public: CSalesProcessActivity* RetrieveSalesProcessActivities(
  CUserAuth*  Caller,
  CObjectName*  Object
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
Object
Specifies the object (opportunity). See CObjectName.

Return Value

Returns a CSalesProcessActivity[] type that specifies the activities associated with the specified opportunity. See CSalesProcessActivity.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strOpportunityId = "{4AAD6AD1-244C-4270-86A2-046BF3CAC92F}";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strOpportunityId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otOpportunity;

   Microsoft.Crm.Platform.Proxy.CSalesProcessActivity[] processactivity;

   processactivity = processcontroller.RetrieveSalesProcessActivities (userAuth, objName);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.RetrieveSalesProcessStages Method

The RetrieveSalesProcessStages method retrieves the stages for an opportunity if that opportunity is in a sales process. See Remarks.

Syntax

[Visual Basic .NET]
Public Function RetrieveSalesProcessStages(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName
) As CSalesProcessStage()
[C#]
public CSalesProcessStage[] RetrieveSalesProcessStages(
  CUserAuth  Caller,
  CObjectName  Object
);
[C++]
public: CSalesProcessStage* RetrieveSalesProcessStages(
  CUserAuth*  Caller,
  CObjectName*  Object
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
Object
Specifies the object (opportunity). See CObjectName.

Return Value

Returns a CSalesProcessStage[] type that specifies the array of stages associated with the specified opportunity. See CSalesProcessStage.

Remarks

A "stage" is equivalent to a "step" in this method.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strOpportunityId = "{4AAD6AD1-244C-4270-86A2-046BF3CAC92F}";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strOpportunityId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otOpportunity;

   Microsoft.Crm.Platform.Proxy.CSalesProcessStage[] processstage;

   // Retrieve the stages
   processstage = processcontroller.RetrieveSalesProcessStages (userAuth, objName);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.RetrieveStepActions Method

The RetrieveStepActions method retrieves all of the actions that are defined for a process step.

Syntax

[Visual Basic .NET]
Public Function RetrieveStepActions(
  ByVal Caller As CUserAuth,
  ByVal StepId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveStepActions(
  CUserAuth  Caller,
  string  StepId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveStepActions(
  CUserAuth*  Caller,
  String*  StepId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadWorkflowProcessInstance privilege to perform this action. See CUserAuth.
StepId
Specifies the ID of the step that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in wfaction.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of actions associated with the specified step. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<wfactions> + wfaction1..N + </wfactions>

where the XML schema for each action is described by wfaction.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId= "{4AAD6AD1-244C-4270-86A2-046BF3CAC92F}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>actionid</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve step actions
   string strResultsXml = processcontroller.RetrieveStepActions (userAuth, strStepId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.SetStep Method

The SetStep method sets a step of a process instance manually. See Remarks.

Syntax

[Visual Basic .NET]
Public Sub SetStep(
  ByVal Caller As CUserAuth,
  ByVal ProcessInstanceId As String,
  ByVal ProcessStepId As String
)
[C#]
public void SetStep(
  CUserAuth  Caller,
  string  ProcessInstanceId,
  string  ProcessStepId
);
[C++]
public: void SetStep(
  CUserAuth*  Caller,
  String*  ProcessInstanceId,
  String*  ProcessStepId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcessInstance privilege to perform this action. See CUserAuth.
ProcessInstanceId
Specifies the ID of the process instance.
ProcessStepId
Specifies the ID of the process step.

Return Value

No return value.

Remarks

The SetStep method bypasses the process logic by manually setting the process instance to the specified step. This can have unexpected results.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strStepId = "{4AAD6AD1-244C-4270-86A2-046BF3CAC92F}";
   string strProcessInstanceId = "{A8CB383D-C9F2-2344-34KE-4A59F7569432}";

   // Set the step
   processcontroller.SetStep (userAuth, strProcessInstanceId, strStepId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProcessController.Terminate Method

The Terminate method terminates a process instance manually.

Syntax

[Visual Basic .NET]
Public Sub Terminate(
  ByVal Caller As CUserAuth,
  ByVal ProcessInstanceId As String
)
[C#]
public void Terminate(
  CUserAuth  Caller,
  string  ProcessInstanceId
);
[C++]
public: void Terminate(
  CUserAuth*  Caller,
  String*  ProcessInstanceId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteWorkflowProcessInstance privilege to perform this action. See CUserAuth.
ProcessInstanceId
Specifies the ID of the process instance that is to be terminated.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProcessController proxy object
Microsoft.Crm.Platform.Proxy.CRMProcessController   processcontroller  = new Microsoft.Crm.Platform.Proxy.CRMProcessController();
processcontroller.Credentials = System.Net.CredentialCache.DefaultCredentials;
processcontroller.Url = strDir + "CRMProcessController.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProcessInstanceId = "{A8CB383D-C9F2-2344-34KE-4A59F7569432}";

   // Terminate the process
   processcontroller.Terminate(userAuth, strProcessInstanceId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProcessController Class
  • Workflow Reference


CRMProduct Class

The CRMProduct class contains methods that you can use to manage products.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMProduct
[Visual Basic .NET]
Public Class CRMProduct
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMProduct : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMProduct: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMProduct class exposes the following methods.

Method | Description
Activate | Sets the state of a product to Active
AddSubstitute | Establishes an association between a product and a substitute product.
AddToKit | Adds a product to a kit.
ConvertToKit | Converts a product to a kit.
ConvertToProduct | Converts a kit to a product.
Create | Creates a new product.
CreateAndRetrieve | Creates a product and then retrieves it.
Deactivate | Sets the state of a product to Inactive.
Delete | Deletes a product.
RemoveAssociation | Eliminates the association between a product and the specified object (lead or competitor).
RemoveFromKit | Removes a product from a kit.
RemoveSubstitute | Eliminates the association between a product and a substitute product.
Retrieve | Retrieves a product.
RetrieveByObject | Retrieves all products that are associated with an object (lead, competitor, or opportunity).
RetrieveByOrganization | Retrieves all the products that are associated with an organization.
RetrieveKitProducts | Retrieves all of the products in a kit.
RetrieveSubstitutes | Retrieves all of the products that are substitutes for the specified product.
SetAssociation | Establishes an association between a product and the specified object (lead or competitor).
Update | Updates a product.
UpdateAndRetrieve | Updates a product and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes
  • Pricing Methods


CRMProduct.Activate Method

The Activate method sets the state of a product to Active.

Syntax

[Visual Basic .NET]
Public Sub Activate(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String,
  ByVal Status As Integer
)
[C#]
public void Activate(
  CUserAuth  Caller,
  string  ProductId,
  int  Status
);
[C++]
public: void Activate(
  CUserAuth*  Caller,
  String*  ProductId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product that is to be activated.
Status
Specifies the status of the product. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";

   // Activate the product
   product.Activate(userAuth, strProductId, -1);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class


CRMProduct.AddSubstitute Method

The AddSubstitute method establishes an association between a product and a substitute product.

Syntax

[Visual Basic .NET]
Public Sub AddSubstitute(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String,
  ByVal SubstituteId As String
)
[C#]
public void AddSubstitute(
  CUserAuth  Caller,
  string  ProductId,
  string  SubstituteId
);
[C++]
public: void AddSubstitute(
  CUserAuth*  Caller,
  String*  ProductId,
  String*  SubstituteId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product.
SubstituteId
Specifies the ID of the substitute product.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";
   string strSubstituteId = "{47B7D5CF-4CE8-4599-AF05-02D7A36BAD3E}";

   // Associates a substitute product
   product.AddSubstitute (userAuth, strProductId, strSubstituteId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class
  • RemoveSubstitute


CRMProduct.AddToKit Method

The AddToKit method adds a product to a kit.

Syntax

[Visual Basic .NET]
Public Sub AddToKit(
  ByVal Caller As CUserAuth,
  ByVal KitId As String,
  ByVal ProductId As String
)
[C#]
public void AddToKit(
  CUserAuth  Caller,
  string  KitId,
  string  ProductId
);
[C++]
public: void AddToKit(
  CUserAuth*  Caller,
  String*  KitId,
  String*  ProductId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
KitId
Specifies the ID of the kit.
ProductId
Specifies the ID of the product.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";
   string strKitId = "{47B7D5CF-4CE8-4599-AF05-02D7A36BAD3E}";

   // Add the product to the kit
   product.AddToKit(userAuth, strKitId, strProductId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class


CRMProduct.ConvertToKit Method

The ConvertToKit method converts a product to a kit.

Syntax

[Visual Basic .NET]
Public Sub ConvertToKit(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String
)
[C#]
public void ConvertToKit(
  CUserAuth  Caller,
  string  ProductId
);
[C++]
public: void ConvertToKit(
  CUserAuth*  Caller,
  String*  ProductId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProductId = "{47B7D5CF-4CE8-4599-AF05-02D7A36BAD3E}";

   // Convert the product to a kit
   product.ConvertToKit (userAuth, strProductId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class


CRMProduct.ConvertToProduct Method

The ConvertToProduct method converts a kit to a product.

Syntax

[Visual Basic .NET]
Public Sub ConvertToProduct(
  ByVal Caller As CUserAuth,
  ByVal KitId As String
)
[C#]
public void ConvertToProduct(
  CUserAuth  Caller,
  string  KitId
);
[C++]
public: void ConvertToProduct(
  CUserAuth*  Caller,
  String*  KitId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
KitId
Specifies the ID of the kit.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strKitId = "{47B7D5CF-4CE8-4599-AF05-02D7A36BAD3E}";

   // Convert the kit to a product
   product.ConvertToProduct(userAuth, strKitId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class


CRMProduct.Create Method

The Create method creates a new product.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal ProductXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  ProductXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  ProductXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct privilege to perform this action. See CUserAuth.
ProductXml
Specifies an XML string representing a product. The XML schema is described by product.xsd.

Return Value

Returns a String type that specifies the ID of the new product.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the product
   string strXml = "<product>";
   strXml += "<name>Test Product 12</name>";
   strXml += "<description>Product 12</description>";
   strXml += "<price>1111.00</price>";
   strXml += "<productnumber>1212</productnumber>";
   strXml += "</product>";

   // Create the product
   string strProductId = product.Create (userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMProduct Class
  • Pricing Methods
  • Update


CRMProduct.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new product and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InProductXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InProductXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InProductXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct and prvReadProduct privileges to perform this action. See CUserAuth.
InProductXml
Specifies an XML string representing a product. The XML schema is described by product.xsd.

Return Value

Returns a String type that specifies the XML data representing the new product. The XML schema is described by product.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the product
   string strXml = "<product>";
   strXml += "<name>Test Product 4</name>";
   strXml += "<description>Product 3</description>";
   strXml += "<price>1111.00</price>";
   strXml += "<productnumber>2333</productnumber>";
   strXml += "</product>";

   // Create the product, and then retrieve the XML data for the product
   string strNewProductXml = product.CreateAndRetrieve (userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMProduct Class
  • Pricing Methods
  • UpdateAndRetrieve


CRMProduct.Deactivate Method

The Deactivate method sets the state of a product to Inactive.

Syntax

[Visual Basic .NET]
Public Sub Deactivate(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String,
  ByVal Status As Integer
)
[C#]
public void Deactivate(
  CUserAuth  Caller,
  string  ProductId,
  int  Status
);
[C++]
public: void Deactivate(
  CUserAuth*  Caller,
  String*  ProductId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product that is to be deactivated.
Status
Specifies the status of the product. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProductId = "{47B7D5CF-4CE8-4599-AF05-02D7A36BAD3E}";

   // Deactivate the product
   product.Deactivate(userAuth, strProductId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class


CRMProduct.Delete Method

The Delete method deletes a product.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ProductId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ProductId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteProduct privilege to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProductId = "{47B7D5CF-4CE8-4599-AF05-02D7A36BAD3E}";

   // Delete the product
   product.Delete(userAuth, strProductId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class


CRMProduct.RemoveAssociation Method

The RemoveAssociation method eliminates the association between a product and the specified object (lead or competitor).

Syntax

[Visual Basic .NET]
Public Sub RemoveAssociation(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String,
  ByVal Object As CObjectName
)
[C#]
public void RemoveAssociation(
  CUserAuth  Caller,
  string  ProductId,
  CObjectName  Object
);
[C++]
public: void RemoveAssociation(
  CUserAuth*  Caller,
  String*  ProductId,
  CObjectName*  Object
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege and either the prvAppendToLead or prvAppendToCompetitor privilege, depending on the object type, to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product.
Object
Specifies the object (lead or competitor) that is to be disassociated from the product. See CObjectName.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProductId = "{47B7D5CF-4CE8-4599-AF05-02D7A36BAD3E}";
   string strLeadId = "{CBF74720-0E3C-43D0-A8C5-CF2D77117F5B}";

   // Initialize the lead object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strLeadId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otLead;

   // Remove the association
   product.RemoveAssociation(userAuth, strProductId, objName);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class
  • SetAssociation


CRMProduct.RemoveFromKit Method

The RemoveFromKit method removes a product from a kit.

Syntax

[Visual Basic .NET]
Public Sub RemoveFromKit(
  ByVal Caller As CUserAuth,
  ByVal KitId As String,
  ByVal ProductId As String
)
[C#]
public void RemoveFromKit(
  CUserAuth  Caller,
  string  KitId,
  string  ProductId
);
[C++]
public: void RemoveFromKit(
  CUserAuth*  Caller,
  String*  KitId,
  String*  ProductId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
KitId
Specifies the ID of the kit.
ProductId
Specifies the ID of the product.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";
   string strKitId = "{47B7D5CF-4CE8-4599-AF05-02D7A36BAD3E}";

   // Remove the product from the kit
   product.RemoveFromKit (userAuth, strKitId, strProductId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class


CRMProduct.RemoveSubstitute Method

The RemoveSubstitute method eliminates the association between a product and a substitute product.

Syntax

[Visual Basic .NET]
Public Sub RemoveSubstitute(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String,
  ByVal SubstituteId As String
)
[C#]
public void RemoveSubstitute(
  CUserAuth  Caller,
  string  ProductId,
  string  SubstituteId
);
[C++]
public: void RemoveSubstitute(
  CUserAuth*  Caller,
  String*  ProductId,
  String*  SubstituteId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product.
SubstituteId
Specifies the ID of the product that is to be substituted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";
   string strSubstituteId = "{47B7D5CF-4CE8-4599-AF05-02D7A36BAD3E}";

   // Remove the substitute product
   product.RemoveSubstitute (userAuth, strProductId, strSubstituteId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • AddSubstitute
  • CRMProduct Class


CRMProduct.Retrieve Method

The Retrieve method retrieves a product.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  ProductId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  ProductId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product that is to be retrieved.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in product.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the product. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by product.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>price</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the product
   string strProductXml = product.Retrieve( userAuth, strProductId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class
  • RetrieveByObject
  • RetrieveByOrganization
  • RetrieveKitProducts
  • RetrieveSubstitutes


CRMProduct.RetrieveByObject Method

The RetrieveByObject method retrieves all products that are associated with an object (lead, competitor, or opportunity).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal StateCodes As Integer(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  int[]  StateCodes,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  long  StateCodes __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
Object
Specifies the object (lead, competitor, or opportunity) to find. See CObjectName.
StateCodes
Specifies an array of states to find. See PRODUCT_STATE.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in product.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of products associated with the specified object (lead, competitor, or opportunity). The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<products> + product1..N + </products>

where the XML schema for each product is described by product.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

String strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strLeadId = "{CBF74720-0E3C-43D0-A8C5-CF2D77117F5B}";
   int[] arrStateCodes = new int[] {Microsoft.Crm.Platform.Types.PRODUCT_STATE.PS_ACTIVE };

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>price</column>";
   strColumnSetXml += "</columnset>";

   //Initialize the lead object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strLeadId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otLead;

   // Retrieve the products that are associated with the lead object
   string strResultsXml = product.RetrieveByObject( userAuth, objName, arrstateCodes, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class
  • Retrieve


CRMProduct.RetrieveByOrganization Method

The RetrieveByOrganization method retrieves all products that are associated with an organization.

Syntax

[Visual Basic .NET]
Public Function RetrieveByOrganization(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal StateCodes As Integer(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByOrganization(
  CUserAuth  Caller,
  string  OrganizationId,
  int[]  StateCodes,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByOrganization(
  CUserAuth*  Caller,
  String*  OrganizationId,
  long  StateCodes __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization to find.
StateCodes
Specifies an array of states to find. See PRODUCT_STATE.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in product.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of products associated with the specified organization. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<products> + product1..N + </products>

where the XML schema for each product is described by product.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // An array of state codes to find
   int[] arrStateCodes = new int[] {Microsoft.Crm.Platform.Types.INVOICE_STATE.INS_ACTIVE,Microsoft.Crm.Platform.Types.PRODUCT_STATE.PS_ACTIVE};

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>price</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the products for this organization
   string strResultsXml= product.RetrieveByOrganization (userAuth, strOrgId, arrStateCodes, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class
  • Retrieve


CRMProduct.RetrieveKitProducts Method

The RetrieveKitProducts method retrieves all of the products in a kit.

Syntax

[Visual Basic .NET]
Public Function RetrieveKitProducts(
  ByVal Caller As CUserAuth,
  ByVal KitId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveKitProducts(
  CUserAuth  Caller,
  string  KitId,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveKitProducts(
  CUserAuth*  Caller,
  String*  KitId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
KitId
Specifies the ID of the kit.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in product.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of products associated with the specified kit. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<products> + product1..N + </products>

where the XML schema for each product is described by product.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;
string strKitId = "{47B7D5CF-4CE8-4599-AF05-02D7A36BAD3E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>price</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the products in this kit
   string strResultsXml = product.RetrieveKitProducts (userAuth, strKitId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class
  • Retrieve


CRMProduct.RetrieveSubstitutes Method

The RetrieveSubstitutes method retrieves all of the products that are substitutes for the specified product

Syntax

[Visual Basic .NET]
Public Function RetrieveSubstitutes(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveSubstitutes(
  CUserAuth  Caller,
  string  ProductId,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveSubstitutes(
  CUserAuth*  Caller,
  String*  ProductId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in product.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of substitute products associated with the specified product. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<products> + product1..N + </products>

where the XML schema for each product is described by product.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>price</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the substitutes for the product
   string strResultsXml = product.RetrieveSubstitutes(userAuth, strProductId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class
  • Retrieve


CRMProduct.SetAssociation Method

The SetAssociation method establishes an association between a product and an object (lead or competitor).

Syntax

[Visual Basic .NET]
Public Sub SetAssociation(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String,
  ByVal Object As CObjectName
)
[C#]
public void SetAssociation(
  CUserAuth  Caller,
  string  ProductId,
  CObjectName  Object
);
[C++]
public: void SetAssociation(
  CUserAuth*  Caller,
  String*  ProductId,
  CObjectName*  Object
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendProduct privilege and either the prvAppendToLead privilege or the prvAppendToCompetitor privilege, depending on the object type, to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product.
Object
Specifies the object (lead or competitor) that is to be associated with the product. See CObjectName.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";
string strLeadId = "{CBF74720-0E3C-43D0-A8C5-CF2D77117F5B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Initialize the lead object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strLeadId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otLead;

   // Set an association with a lead object
   product.SetAssociation (userAuth, strProductId, objName);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProduct Class
  • RemoveAssociation


CRMProduct.Update Method

The Update method updates a product.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String,
  ByVal ProductXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  ProductId,
  string  ProductXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  ProductId,
  String*  ProductXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product that is to be updated.
ProductXml
Specifies an XML string representing a product. The XML schema is described by product.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up new XML string for the product
   string strXml = "<product>";
   strXml += "<name>Test Product 123</name>";
   strXml += "<description>Product 123</description>";
   strXml += "<price>1111.00</price>";
   strXml += "<productnumber>4422</productnumber>";
   strXml += "</product>";

   // Update the product
   product.Update (userAuth, strProductId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMProduct Class
  • Pricing Methods
  • UpdateAndRetrieve


CRMProduct.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a product and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String,
  ByVal InProductXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  ProductId,
  string  InProductXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  ProductId,
  String*  InProductXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct and prvReadProduct privileges to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product that is to be updated.
InProductXml
Specifies an XML string representing a product. The XML schema is described by product.xsd.

Return Value

Returns a String type that specifies the XML data representing the product. The XML schema is described by product.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMProduct proxy object
Microsoft.Crm.Platform.Proxy.CRMProduct   product = new Microsoft.Crm.Platform.Proxy.CRMProduct();
product.Credentials = System.Net.CredentialCache.DefaultCredentials;
product.Url = strDir + "CRMProduct.srf";

string strErrorMsg;
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the product
   string strXml = "<product>";
   strXml += "<name>Test Product 123</name>";
   strXml += "<description>Product 123</description>";
   strXml += "<price>1111.00</price>";
   strXml += "<productnumber>4422</productnumber>";
   strXml += "</product>";

   // Update the product, and then retrieve it
   string strResultsXml = product.UpdateAndRetrieve(userAuth, strProductId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMProduct Class
  • Pricing Methods
  • Update


CRMProductPriceLevel Class

The CRMProductPriceLevel class contains methods that you can use to manage product price levels.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMProductPriceLevel
[Visual Basic .NET]
Public Class CRMProductPriceLevel
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMProductPriceLevel : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMProductPriceLevel: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMProductPriceLevel class exposes the following methods.

Method | Description
Create | Creates a new product price level.
CreateAndRetrieve | Creates a product price level and then retrieves it.
Delete | Deletes a product price level.
Retrieve | Retrieves a product price level.
RetrieveByObject | Retrieves all product price levels that are associated with an object (product or price level).
Update | Updates a product price level.
UpdateAndRetrieve | Updates a product price level object and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes
  • Pricing Methods


Pricing Methods

The Microsoft CRM application uses the pricingmethodcode attribute of the product price level object for determining prices. The pricingmethodcode value affects the following:

  • How the price for the product is determined for each unit of measure that is defined for that product.
  • What attributes are required when you create or update a product price level and its associated product.

The formulas that are used for each value and the attributes that are required by each value are shown in the following table of pricingmethodcode attribute values.

Drop-down list value
and equivalent
PRICE_METHOD value 		Description and required attributes
Currency Amount

PM_CURRENCY_AMOUNT

 The price is specified for each unit of measure for each product.
price = amount

For each unit of measure for each product, you must enter data in one attribute:

  • amount attribute of the product price level object
Percent of List

PM_PERCENT_LIST_PRICE

 The price is calculated on the basis of the manufacturer's or distributor's list price.
calculated price = list price x percentage

For each unit of measure for each product, you must enter data in three attributes:

  • price attribute of the product object (List Price in the Product form).
  • percentage attribute of the product price level object. This is the desired percentage of the list price.
  • roundingpolicycode attribute of the product price level object.
Percent Markup - Current Cost

PM_MARKUP_CURRENT_COST

 The price is calculated as a percentage of your current cost for the item.
calculated price = current cost x
100% + percentage)

For each unit of measure for each product, you must enter data in three attributes:

  • currentcost attribute of the product object. You must update this cost each time you receive a shipment of the item; the price changes accordingly.
  • percentage attribute of the product price level object. This is the percent markup.
  • roundingpolicycode attribute of the product price level object
Percent Margin - Current Cost

PM_MARGIN_CURRENT_COST

 The price is based on the profit percentage you want to achieve and your current cost for the item.
calculated price = current cost +
[(current cost x percentage)/
(100% - percentage)]

For each unit of measure for each product, you must enter data in three attributes:

  • currentcost attribute of the product object. You must update this cost each time you receive a shipment of the item; the price changes accordingly.
  • percentage attribute of the product price level object. This is the profit percentage you want to achieve.
  • roundingpolicycode attribute of the product price level object
Percent Markup - Standard Cost

PM_MARKUP_STANDARD_COST

 The price is calculated as a percentage of the standard cost of the item.
calculated price = standard cost x
100% + percentage)

Because the standard cost is updated periodically, the standard cost amount in this equation is an average and won't always be the same as the amount you paid most recently for the item.

For each unit of measure for each product, you must enter data in three attributes:

  • standardcost attribute of the product object. Each time you update the standard cost, the price changes.
  • percentage of the product price level object. This is the percent markup.
  • roundingpolicycode of the product price level object.
Percent Margin - Standard Cost

PM_MARGIN_STANDARD_COST

 The price is based on the profit percentage you want to achieve and the standard cost of the item:
calculated price = standard cost +
[(standard cost x percentage)/
(100% - percentage)]

Because the standard cost is updated periodically, the standard cost amount in this equation is an average and won't always be the same as the amount you paid most recently for the item.

For each unit of measure for each product, you must enter data in three attributes:

  • standardcost attribute of the product object. Each time you update the standard cost, the price changes.
  • percentage attribute of the product price level object. This is the profit percentage you want to achieve.
  • roundingpolicycode of the product price level object.

To view the pricingmethodcode value for an existing product price level, use the PRICE_METHOD class.

To set the values for the pricingmethodcode attribute and the other product price level object attributes referred to in the preceding table, use the methods in the CRMProductPriceLevel class.

To set the values for the product object attributes referred to in the preceding table, use the methods in the CRMProduct class.

The XML schema for the product price level object is described by productpricelevel.xsd.

The XML schema for the product object is described by product.xsd.


CRMProductPriceLevel.Create Method

The Create method creates a new product price level.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal ProductPriceLevelXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  ProductPriceLevelXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  ProductPriceLevelXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct privilege to perform this action. See CUserAuth.
ProductPriceLevelXml
Specifies an XML string representing a product price level. The XML schema is described by productpricelevel.xsd.

Return Value

Returns a String type that specifies the ID of the new product price level.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel  productpricelevel = new Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel();
productpricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
productpricelevel.Url = strDir + "CRMProductpricelevel.srf";

string strErrorMsg;
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";
string strPriceLevelId = "{63FE40BC-B59B-43C5-A856-82DDC400E25B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the product price level
   string strXml = "<productpricelevel>";
   strXml += "<productid>" + strProductId + "</productid>";
   strXml += "<pricelevelid>" + strPriceLevelId + "</pricelevelid>";
   strXml += "</productpricelevel>";

   // Create the product price level
   string strProductPriceLevelId = productpricelevel.Create (userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMProductPriceLevel Class
  • Pricing Methods
  • Update


CRMProductPriceLevel.CreateAndRetrieve Method

The CreateAndRetrieve method creates a product price level and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InProductPriceLevelXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InProductPriceLevelXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InProductPriceLevelXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvCreateProduct and prvReadProduct privileges to perform this action. See CUserAuth.
InProductPriceLevelXml
Specifies an XML string representing a product price level. The XML schema is described by productpricelevel.xsd.

Return Value

Returns a String type that specifies the XML data representing the new product price level. The XML schema is described by productpricelevel.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel  productpricelevel = new Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel();
productpricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
productpricelevel.Url = strDir + "CRMProductpricelevel.srf";

string strErrorMsg;
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";
string strPriceLevelId = "{63FE40BC-B59B-43C5-A856-82DDC400E25B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the product price level
   string strXml = "<productpricelevel>";
   strXml += "<productid>" + strProductId + "</productid>";
   strXml += "<pricelevelid>" + strPriceLevelId + "</pricelevelid>";
   strXml += "</productpricelevel>";

   // Create the product price level, and then retrieve it
   string strResultsXml = productpricelevel.CreateAndRetrieve (userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMProductPriceLevel Class
  • Pricing Methods
  • UpdateAndRetrieve


CRMProductPriceLevel.Delete Method

The Delete method deletes a product price level.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal ProductPriceLevelId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  ProductPriceLevelId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  ProductPriceLevelId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteProduct privilege to perform this action. See CUserAuth.
ProductPriceLevelId
Specifies the ID of the product price level that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel  productpricelevel = new Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel();
productpricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
productpricelevel.Url = strDir + "CRMProductpricelevel.srf";

string strErrorMsg;
string strProductPriceLevelId = "{B616EA61-0EDD-4582-B8A5-A4B8E437DD47}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the product price level
   productpricelevel.Delete (userAuth, strProductPriceLevelId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProductPriceLevel Class


CRMProductPriceLevel.Retrieve Method

The Retrieve method retrieves a product price level by ID.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal ProductPriceLevelId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  ProductPriceLevelId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  ProductPriceLevelId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
ProductPriceLevelId
Specifies the ID of the product price level that is to be retrieved.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in productpricelevel.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the product price level. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by productpricelevel.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel  productpricelevel = new Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel();
productpricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
productpricelevel.Url = strDir + "CRMProductpricelevel.srf";

string strErrorMsg;
string strProductPriceLevelId = "{B616EA61-0EDD-4582-B8A5-A4B8E437DD47}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>productid</column>";
   strColumnSetXml += "<column>pricelevelid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the product price level
   string strResultsXml = productpricelevel.Retrieve(userAuth, strProductPriceLevelId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProductPriceLevel Class
  • RetrieveByObject


CRMProductPriceLevel.RetrieveByObject Method

The RetrieveByObject method retrieves all product price levels that are associated with an object (product or price level).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
Object
Specifies the linked object (product or price level). See CObjectName.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in productpricelevel.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of product price levels associated with the specified object. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<productpricelevels> + productpricelevel1..N + </productpricelevels>

where the XML schema for each product price level is described by productpricelevel.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel  productpricelevel = new Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel();
productpricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
productpricelevel.Url = strDir + "CRMProductpricelevel.srf";

string strErrorMsg;
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>productid</column>";
   strColumnSetXml += "<column>pricelevelid</column>";
   strColumnSetXml += "</columnset>";

   // Initialize the product object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strProductId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otProduct;

   // Retrieve the product price levels by object
   string strResultsXml = productpricelevel.RetrieveByObject (userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMProductPriceLevel Class
  • Retrieve


CRMProductPriceLevel.Update Method

The Update method updates a product price level.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal ProductPriceLevelId As String,
  ByVal ProductPriceLevelXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  ProductPriceLevelId,
  string  ProductPriceLevelXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  ProductPriceLevelId,
  String*  ProductPriceLevelXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
ProductPriceLevelId
Specifies the ID of the product price level that is to be updated.
ProductPriceLevelXml
Specifies an XML string representing a product price level. The XML schema is described by productpricelevel.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel  productpricelevel = new Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel();
productpricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
productpricelevel.Url = strDir + "CRMProductpricelevel.srf";

string strErrorMsg;
string strProductPriceLevelId = "{B616EA61-0EDD-4582-B8A5-A4B8E437DD47}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the product price level
   string strXml = "<productpricelevel>";
   strXml += "<percentage>10.10</percentage>";
   strXml += "</productpricelevel>";

   // Update the product price level
   productpricelevel.Update (userAuth, strProductPriceLevelId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMProductPriceLevel Class
  • Pricing Methods
  • UpdateAndRetrieve


CRMProductPriceLevel.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a product price level and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal ProductPriceLevelIn As String,
  ByVal InProductPriceLevelXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  ProductPriceLevelIn,
  string  InProductPriceLevelXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  ProductPriceLevelIn,
  String*  InProductPriceLevelXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvWriteProduct and prvReadProduct privileges to perform this action. See CUserAuth.
ProductPriceLevelId
Specifies the ID of the product price level that is to be updated.
InProductPriceLevelXml
Specifies an XML string representing a product price level. The XML schema is described by productpricelevel.xsd.

Return Value

Returns a String type that specifies the XML data representing the product price level. The XML schema is described by productpricelevel.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel  productpricelevel = new Microsoft.Crm.Platform.Proxy.CRMProductPriceLevel();
productpricelevel.Credentials = System.Net.CredentialCache.DefaultCredentials;
productpricelevel.Url = strDir + "CRMProductpricelevel.srf";

string strErrorMsg;
string strProductPriceLevelId = "{B616EA61-0EDD-4582-B8A5-A4B8E437DD47}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the product price level
   string strXml = "<productpricelevel>";
   strXml += "<percentage>11.10</percentage>";
   strXml += "</productpricelevel>";

   // Update the product price level, and then retrieve it
   string strResultsXml = productpricelevel.UpdateAndRetrieve (userAuth, strProductPriceLevelId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMProductPriceLevel Class
  • Pricing Methods
  • Update


CRMQuery Class

The CRMQuery class contains methods that you can use to manage queries.

Note These methods use the Fetch XML syntax for specifying queries against the Microsoft CRM database. For more information about using Fetch XML , see Fetch XML schema.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMQuery
[Visual Basic .NET]
Public Class CRMQuery
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMQuery : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMQuery: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMQuery class exposes the following methods.

Method | Description
ColumnsById | Returns the ColumnSet of a saved query.
Create | Creates a new query.
CreateAndRetrieve | Creates a new query and then retrieves it.
Delete | Deletes a query.
ExecuteById | Executes a query and returns the ResultSet and the ColumnSet for that query.
ExecuteQuery | Executes a query in the Fetch XML format.
MakeAvailableToOrganization | Grants read access to an organization and revokes previously granted read access rights for that organization.
MakeAvailableToTeams | Grants read access to a list of teams and revokes previously granted read access rights for those teams.
ResultsById | Executes a query and returns the ResultSet.
Retrieve | Retrieves an existing query.
RetrieveByType | Retrieves all of the queries that have the specified query return type, query type, and customizable flag value.
RetrievePublicQueriesByType | Retrieves all of the public queries for the specified query return type.
RetrieveSharedTeams | Retrieves the teams that have access to the specified query.
Update | Updates the specified query.
UpdateAndRetrieve | Updates the specified query and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Fetch XML schema
  • Microsoft.Crm.Platform.Proxy Classes


CRMQuery.ColumnsById Method

The ColumnsById method returns the ColumnSet of a saved query.

Syntax

[Visual Basic .NET]
Public Function ColumnsById(
  ByVal Caller As CUserAuth,
  ByVal QueryId As String
) As String
[C#]
public string ColumnsById(
  CUserAuth  Caller,
  string  QueryId
);
[C++]
public: String* ColumnsById(
  CUserAuth*  Caller,
  String*  QueryId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuery privilege to perform this action. See CUserAuth.
QueryId
Specifies the ID of the query.

Return Value

Returns a String type that specifies the XML data containing the set of columns. The XML schema is described by savedquery.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;
string strQueryId = "{DC5006D0-7FD7-4908-A747-D5723166EBDF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Get the columns for this query
   string strResultsXml = query.ColumnsById(userAuth, strQueryId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuery Class


CRMQuery.Create Method

The Create method creates a new query.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal objectType As ObjectType,
  ByVal QueryXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  ObjectType  objectType,
  string  QueryXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  ObjectType  objectType,
  String*  QueryXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateQuery privilege to perform this action. See CUserAuth.
ObjectType
Specifies the type of object that is to be queried. See CObjectName.
QueryXML
Specifies an XML string representing the query. The XML schema is described by savedquery.xsd.

Return Value

Returns a String type that specifies the ID of the newly created query.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;
string strQueryXml;
string strQueryId;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the query
   strQueryXml = "<savedquery>";
   strQueryXml += "<description>Account query</description>";
   strQueryXml += "<name>My Account 1</name>";
   strQueryXml += "<isquickfindquery>1</isquickfindquery>";
   strQueryXml += "<iscustomizable>1</iscustomizable>";
   strQueryXml += "<returnedtypecode>1</returnedtypecode>";
   strQueryXml += "<isdefault>1</isdefault>";
   strQueryXml += "<querytype>" + Microsoft.Crm.Platform.Types.SAVED_QUERY_TYPE.ADVANCED_SEARCH.ToString() + "</querytype>";
   strQueryXml += "</savedquery>";

   // Create the query
   strQueryId = query.Create(userAuth, Microsoft.Crm.Platform.Proxy.ObjectType.otAccount, strQueryXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMQuery Class
  • Fetch XML Schema
  • Update


CRMQuery.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new query and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal objectType As ObjectType,
  ByVal QueryXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  ObjectType  objectType,
  string  QueryXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  ObjectType  objectType,
  String*  QueryXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateQuery and prvReadQuery privileges to perform this action. See CUserAuth.
ObjectType
Specifies the type of object that is to be queried. See CObjectName.
QueryXML
Specifies an XML string representing the query. The XML schema is described by savedquery.xsd.

Return Value

Returns a String type that specifies the XML data representing the new query. The XML schema is described by savedquery.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;
string strQueryXml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the query
   strQueryXml = "<savedquery>";
   strQueryXml += "<description>Account query</description>";
   strQueryXml += "<name>Account Query 3</name>";
   strQueryXml += "<isquickfindquery>1</isquickfindquery>";
   strQueryXml += "<iscustomizable>1</iscustomizable>";
   strQueryXml += "<returnedtypecode>1</returnedtypecode>";
   strQueryXml += "<isdefault>1</isdefault>";
   strQueryXml += "<querytype>" + Microsoft.Crm.Platform.Types.SAVED_QUERY_TYPE.ADVANCED_SEARCH.ToString() + "</querytype>";
   strQueryXml += "</savedquery>";

   // Create the query, and the retrieve it
   string strResultsXml = query.CreateAndRetrieve(userAuth, Microsoft.Crm.Platform.Proxy.ObjectType.otAccount, strQueryXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMQuery Class
  • Fetch XML Schema
  • UpdateAndRetrieve


CRMQuery.Delete Method

The Delete method deletes a query.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal QueryId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  QueryId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  QueryId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteQuery privilege to perform this action. See CUserAuth.
QueryId
Specifies the ID of the query that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strQueryId = "{DC5006D0-7FD7-4908-A747-D5723166EBDF}";

   // Delete the query
   query.Delete (userAuth, strQueryId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuery Class


CRMQuery.ExecuteById Method

The ExecuteById method executes a query and returns the ResultSet and the ColumnSet for that query.

Syntax

[Visual Basic .NET]
Public Function ExecuteById(
  ByVal Caller As CUserAuth,
  ByVal QueryId As String,
  ByRef QueryResultXML As String
) As String
[C#]
public string ExecuteById(
  CUserAuth  Caller,
  string  QueryId,
  out string  QueryResultXML
);
[C++]
public: String* ExecuteById(
  CUserAuth*  Caller,
  String*  QueryId,
  String**  QueryResultXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuery privilege and the READ privilege for each of the object types referenced in the query to perform this action. See CUserAuth.
QueryId
Specifies the ID of the query that is to be executed.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. See ObjectSchemas for more information.

Return Value

Returns a String type that specifies the XML data representing the results of the query. The XML schema is described in ObjectSchemas.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;
string strQueryXml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strQueryId = "{DC5006D0-7FD7-4908-A747-D5723166EBDF}";

   // Execute the query by ID
   string strResultsXml = query.ExecuteById(userAuth, strQueryId, out strQueryXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuery Class


CRMQuery.ExecuteQuery Method

The ExecuteQuery method executes a query in the Fetch XML format.

Note For any given object, using the ExecuteQuery method is slower than using the Retrieve method because the ExecuteQuery method requires parsing and validation of the Fetch XML. You can use the Retrieve method for an object for better performance.

Syntax

[Visual Basic .NET]
Public Function ExecuteQuery(
  ByVal Caller As CUserAuth,
  ByVal QueryXML As String
) As String
[C#]
public string ExecuteQuery(
  CUserAuth  Caller,
  string  QueryXML
);
[C++]
public: String* ExecuteQuery(
  CUserAuth*  Caller,
  String*  QueryXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the READ privilege for the object type being queried to perform this action. See CUserAuth.
QueryXML
Specifies the Fetch XML string representing the query. See Fetch XML Schema for more information.

Return Value

Returns a String type that specifies the XML data containing the results of the query. See ObjectSchemas for more information. This XML string is in the following format:

<resultset> + <result>result1</result><result>result2</result> + ... + </resultset>

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

String strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the Fetch XML to retrieve all of the account information
   string strQueryXML = "<fetch mapping='logical'><entity name='account'><all-attributes/></entity></fetch>";

   // Execute the query
   string strQueryResultXml = query.ExecuteQuery(userAuth, strQueryXML);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuery Class
  • Fetch XML Schema


CRMQuery.MakeAvailableToOrganization Method

The MakeAvailableToOrganization method grants read access to an organization and automatically revokes previously granted read access rights for that organization.

Syntax

[Visual Basic .NET]
Public Sub MakeAvailableToOrganization(
  ByVal Caller As CUserAuth,
  ByVal QueryId As String,
  ByVal OrganizationId As String
)
[C#]
public void MakeAvailableToOrganization(
  CUserAuth  Caller,
  string  QueryId,
  string  OrganizationId
);
[C++]
public: void MakeAvailableToOrganization(
  CUserAuth*  Caller,
  String*  QueryId,
  String*  OrganizationId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQuery privilege to perform this action. See CUserAuth.
QueryId
Specifies the ID of the query.
OrganizationId
Specifies the ID of the organization.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;
string strOrgId ="{3BECB6A6-0DD8-4061-98D9-0B9E897C5027}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strQueryId = "{DC5006D0-7FD7-4908-A747-D5723166EBDF}";

   // Make the query available to the organization
   query.MakeAvailableToOrganization (userAuth, strQueryId, strOrgId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuery Class


CRMQuery.MakeAvailableToTeams Method

The MakeAvailableToTeams method grants read access to a list of teams and automatically revokes previously granted read access rights for those teams.

Syntax

[Visual Basic .NET]
Public Sub MakeAvailableToTeams(
  ByVal Caller As CUserAuth,
  ByVal QueryId As String,
  ByVal TeamIds As String()
)
[C#]
public void MakeAvailableToTeams(
  CUserAuth  Caller,
  string  QueryId,
  string[]  TeamIds
);
[C++]
public: void MakeAvailableToTeams(
  CUserAuth*  Caller,
  String*  QueryId,
  String*  TeamIds __gc[]
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQuery privilege to perform this action. See CUserAuth.
QueryId
Specifies the ID of the query.
TeamIds
Specifies an array of team IDs.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strQueryId = "{DC5006D0-7FD7-4908-A747-D5723166EBDF}";

   string[] strTeamIds = new string [2];
   strTeamIds[0] = "{42283B2A-9B46-4d89-AFBF-42F0B5F30A58}";
   strTeamIds[1] = "{2E41C122-F1BD-4824-B748-0826CEC13CFC}";

   // Make the query available to teams
   query.MakeAvailableToTeams(userAuth, strQueryId, strTeamIds);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuery Class


CRMQuery.ResultsById Method

The ResultsById method executes a query and returns the ResultSet for that query.

Syntax

[Visual Basic .NET]
Public Function ResultsById(
  ByVal Caller As CUserAuth,
  ByVal QueryId As String
) As String
[C#]
public string ResultsById(
  CUserAuth  Caller,
  string  QueryId
);
[C++]
public: String* ResultsById(
  CUserAuth*  Caller,
  String*  QueryId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuery privilege and the READ privilege on the object types referenced in the query to perform this action. See CUserAuth.
QueryId
Specifies the ID of the query.

Return Value

Returns a String type that specifies the XML data representing the updated query. The XML schema is described in ObjectSchemas.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strQueryId = "{DC5006D0-7FD7-4908-A747-D5723166EBDF}";

   // Get the results by ID
   string strResultsXml = query.ResultsById(userAuth, strQueryId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuery Class


CRMQuery.Retrieve Method

The Retrieve method retrieves an existing query.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal QueryId As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  QueryId
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  QueryId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuery privilege to perform this action. See CUserAuth.
QueryId
Specifies the ID of the query that is to be retrieved.

Return Value

Returns a String type that specifies the XML data representing the query. This XML string is in the format

<savedquery><query> + query + </query></savedquery>

where the XML schema for the saved query is described by savedquery.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strQueryId = "{DC5006D0-7FD7-4908-A747-D5723166EBDF}";

   // Retrieve the query
   string strQueryXml = query.Retrieve (userAuth, strQueryId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuery Class
  • RetrieveByType


CRMQuery.RetrieveByType Method

The RetrieveByType method retrieves all of the queries that have the specified return type, query type, and customizable flag value.

Syntax

[Visual Basic .NET]
Public Function RetrieveByType(
  ByVal Caller As CUserAuth,
  ByVal ReturnedType As ObjectType(),
  ByVal QueryType As SAVED_QUERY_TYPE(),
  ByVal CustomizableOnly As Integer,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByType(
  CUserAuth  Caller,
  ObjectType[]  ReturnedType,
  SAVED_QUERY_TYPE[]  QueryType,
  int  CustomizableOnly,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByType(
  CUserAuth*  Caller,
  ObjectType  ReturnedType __gc[],
  SAVED_QUERY_TYPE  QueryType __gc[],
  long  CustomizableOnly,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuery privilege to perform this action. See CUserAuth.
ReturnedType
Specifies an array of object types for which queries are to be retrieved. See ObjectType.
QueryType
Specifies an array of query types. See SAVED_QUERY_TYPE.
CustomizableOnly
Specifies whether the query is customizable.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in savedquery.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of queries associated with the specified return type, query type, and iscustomizable flag for security principals who have READ privileges. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<savedqueries> + savedquery1..N + </savedqueries>

where the XML schema for each saved query is described by savedquery.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumns = "<columnset>";
   strColumns += "<column>description</column>";
   strColumns += "<column>name</column>";
   strColumns += "</columnset>";

   // Intialize the object type
   Microsoft.Crm.Platform.Proxy.ObjectType[] accountTypes = new Microsoft.Crm.Platform.Proxy.ObjectType[1];
   accountTypes[0] = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Intialize the saved query type
   Microsoft.Crm.Platform.Proxy.SAVED_QUERY_TYPE[] savedQType = new Microsoft.Crm.Platform.Proxy.SAVED_QUERY_TYPE[1];
   savedQType[0] = Microsoft.Crm.Platform.Proxy.SAVED_QUERY_TYPE.ADVANCED_SEARCH;

   // Retrieve the query by type
   string strResultsXml = query.RetrieveByType (userAuth, accountTypes, savedQType, 1, strColumns);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuery Class
  • Retrieve


CRMQuery.RetrievePublicQueriesByType Method

The RetrievePublicQueriesByType method retrieves all of the public queries for the specified query return type for security principals who have READ privileges for the object types specified.

Syntax

[Visual Basic .NET]
Public Function RetrievePublicQueriesByType(
  ByVal Caller As CUserAuth,
  ByVal ReturnedType As ObjectType(),
  ByVal QueryTypes As SAVED_QUERY_TYPE(),
  ByVal ColumnSet As String
) As String
[C#]
public string RetrievePublicQueriesByType(
  CUserAuth  Caller,
  ObjectType[]  ReturnedType,
  SAVED_QUERY_TYPE[]  QueryTypes,
  string  ColumnSet
);
[C++]
public: String* RetrievePublicQueriesByType(
  CUserAuth*  Caller,
  ObjectType  ReturnedType __gc[],
  SAVED_QUERY_TYPE  QueryTypes __gc[],
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuery privilege to perform this action. See CUserAuth.
ReturnedType
Specifies an array of object types for which queries are to be retrieved. See ObjectType.
QueryTypes
Specifies an array of query types. See SAVED_QUERY_TYPE.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in savedquery.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of queries associated with the specified query return type for security principals with READ privileges. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<savedqueries> + savedquery1..N + </savedqueries>

where the XML schema for each saved query is described by savedquery.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumns = "<columnset>";
   strColumns += "<column>description</column>";
   strColumns += "<column>name</column>";
   strColumns += "</columnset>";

   // Intialize the object type
   Microsoft.Crm.Platform.Proxy.ObjectType[] accountTypes = new Microsoft.Crm.Platform.Proxy.ObjectType[1];
   accountTypes[0] = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // Intialize the saved query type
   Microsoft.Crm.Platform.Proxy.SAVED_QUERY_TYPE[] savedQType = new Microsoft.Crm.Platform.Proxy.SAVED_QUERY_TYPE[1];
   savedQType[0] = Microsoft.Crm.Platform.Proxy.SAVED_QUERY_TYPE.ADVANCED_SEARCH;

   // Retrieve public queries
   string strResultsXml = query.RetrievePublicQueriesByType (userAuth, accountTypes, savedQType, strColumns);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

  • CRMQuery Class


CRMQuery.RetrieveSharedTeams Method

The RetrieveSharedTeams method retrieves all of the teams that have access to the specified query. This method returns an empty collection XML string if the query has been made available to the whole organization.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedTeams(
  ByVal Caller As CUserAuth,
  ByVal QueryId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveSharedTeams(
  CUserAuth  Caller,
  string  QueryId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveSharedTeams(
  CUserAuth*  Caller,
  String*  QueryId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuery privilege to perform this action. See CUserAuth.
QueryId
Specifies the ID of the query.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in team.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of teams who have access to the query. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<teams> + team1..N + </teams>

where the XML schema for each team is described by team.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;
string strQueryId= "{DC5006D0-7FD7-4908-A747-D5723166EBDF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumns = "<columnset>";
   strColumns += "<column>description</column>";
   strColumns += "<column>name</column>";
   strColumns += "</columnset>";

   // Retrieve the teams that are sharing this query
   string strResultsXml = query.RetrieveSharedTeams (userAuth, strQueryId, strColumns);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuery Class
  • Retrieve


CRMQuery.Update Method

The Update method updates the specified query.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal QueryId As String,
  ByVal QueryXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  QueryId,
  string  QueryXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  QueryId,
  String*  QueryXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQuery privilege to perform this action. See CUserAuth.
QueryId
Specifies the ID of the query that is to be updated.
QueryXML
Specifies an XML string representing the query. The XML schema is described by savedquery.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;
string strQueryId = "{DC5006D0-7FD7-4908-A747-D5723166EBDF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the query
   string strQueryXml = "<savedquery>";
   strQueryXml += "<description>accounts1</description>";
   strQueryXml += "<name>myaccountupdated</name>";
   strQueryXml += "</savedquery>";

   // Update the query
   query.Update(userAuth, strQueryId, strQueryXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMQuery Class
  • Fetch XML Schema
  • UpdateAndRetrieve


CRMQuery.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates the specified query and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal QueryId As String,
  ByVal QueryXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  QueryId,
  string  QueryXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  QueryId,
  String*  QueryXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQuery and prvReadQuery privileges to perform this action. See CUserAuth.
QueryId
Specifies the ID of the query that is to be updated.
QueryXML
Specifies an XML string representing the query. The XML schema is described by savedquery.xsd.

Return Value

Returns a String type that specifies the XML data representing the query. The XML schema is described by savedquery.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "mystrServername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuery proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new Microsoft.Crm.Platform.Proxy.CRMQuery();
query.Credentials = System.Net.CredentialCache.DefaultCredentials;
query.Url = strDir + "CRMQuery.srf";

string strErrorMsg;
string strQueryId = "{DC5006D0-7FD7-4908-A747-D5723166EBDF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the query
   string strQueryXml = "<savedquery>";
   strQueryXml += "<description>accounts1</description>";
   strQueryXml += "<name>myaccountupdated</name>";
   strQueryXml += "</savedquery>";

   // Update the query, and then retrieve it
   string strResultsXml = query.UpdateAndRetrieve(userAuth, strQueryId, strQueryXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMQuery Class
  • Fetch XML Schema
  • Update


CRMQueue Class

The CRMQueue class contains methods that you can use to manage queues. There are three types of queues:

  • A public queue is a queue that is created by the business unit to help organize where activities and cases should be routed.
  • A private queue is a queue that contains all items assigned to a user that they have not started working on yet.
  • A work in progress queue is a queue that contains all items assigned to a user that they are currently working on.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMQueue
[Visual Basic .NET]
Public Class CRMQueue
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMQueue : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMQueue: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMQueue class exposes the following methods.

Method | Description
Create | Creates a new public queue.
CreateAndRetrieve | Creates a new public queue and then retrieves it.
Delete | Deletes a public queue.
Retrieve | Retrieves a queue.
RetrieveByObject | Retrieves all queues that are associated with the specified object (incident or activity).
RetrieveQueues | Retrieves private, WipBin, or public queues for the specified business or organization.
Update | Updates a public queue.
UpdateAndRetrieve | Updates a public queue and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMQueue.Create Method

The Create method creates a public queue.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal QueueXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  QueueXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  QueueXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateQueue privilege to perform this action. See CUserAuth.
QueueXML
Specifies an XML string representing the queue. The XML schema is described by queue.xsd.

Return Value

Returns a String type that specifies the ID of the newly created queue.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQueue proxy object
Microsoft.Crm.Platform.Proxy.CRMQueue  queue = new Microsoft.Crm.Platform.Proxy.CRMQueue();
queue.Credentials = System.Net.CredentialCache.DefaultCredentials;
queue.Url = strDir + "CRMQueue.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the queue
   string strQueueXml = "<queue>";
   strQueueXml += "<businessunitid>" + userAuth.MerchantId + "</businessunitid>";
   strQueueXml += "<primaryuserid>" + userAuth.UserId + "</primaryuserid>";
   strQueueXml += "</queue>";

   // Create the queue
   string strQueueid = queue.Create(userAuth, strQueueXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMQueue Class
  • Update


CRMQueue.CreateAndRetrieve Method

The CreateAndRetrieve method creates a public queue and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal QueueXML As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  QueueXML,
  string  ColumnSetXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  QueueXML,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateQueue and prvReadQueue privileges to perform this action. See CUserAuth.
QueueXML
Specifies an XML string representing the queue. The XML schema is described by queue.xsd.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in queue.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the new queue. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by queue.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQueue proxy object
Microsoft.Crm.Platform.Proxy.CRMQueue  queue = new Microsoft.Crm.Platform.Proxy.CRMQueue();
queue.Credentials = System.Net.CredentialCache.DefaultCredentials;
queue.Url = strDir + "CRMQueue.srf";

string strErrorMsg;
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the queue
   string strQueueXml = "<queue>";
   strQueueXml += "<businessunitid>" + userAuth.MerchantId + "</businessunitid>";
   strQueueXml += "<primaryuserid>" + userAuth.UserId + "</primaryuserid>";
   strQueueXml += "</queue>";

   // Create and then retrieve the queue
   string strResultXml = queue.CreateAndRetrieve(userAuth, strQueueXml, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMQueue Class
  • UpdateAndRetrieve


CRMQueue.Delete Method

The Delete method deletes a public queue.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal QueueId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  QueueId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  QueueId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteQueue privilege to perform this action. See CUserAuth.
QueueId
Specifies the ID of the queue that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQueue proxy object
Microsoft.Crm.Platform.Proxy.CRMQueue  queue = new Microsoft.Crm.Platform.Proxy.CRMQueue();
queue.Credentials = System.Net.CredentialCache.DefaultCredentials;
queue.Url = strDir + "CRMQueue.srf";

string strErrorMsg;
string strQueueId="{0961553A-D5DD-462E-AB11-C3750DC1A9F9}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the queue
   queue.Delete(userAuth, strQueueId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQueue Class


CRMQueue.Retrieve Method

The Retrieve method retrieves a queue by ID.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal QueueId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  QueueId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  QueueId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQueue privilege to perform this action. See CUserAuth.
QueueId
Specifies the ID of the queue that is to be retrieved.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in queue.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the queue. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by queue.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQueue proxy object
Microsoft.Crm.Platform.Proxy.CRMQueue  queue = new Microsoft.Crm.Platform.Proxy.CRMQueue();
queue.Credentials = System.Net.CredentialCache.DefaultCredentials;
queue.Url = strDir + "CRMQueue.srf";

string strErrorMsg;
string strQueueId = "{0961553A-D5DD-462E-AB11-C3750DC1A9F9}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the queue. Passing null for ColumnSet retrieves all of the columns
   string strResultXml = queue.Retrieve(userAuth, strQueueid, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQueue Class


CRMQueue.RetrieveByObject Method

The RetrieveByObject method retrieves all queues that are associated with the specified object (incident or activity).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQueue privilege to perform this action. See CUserAuth.
Object
Specifies the object (incident or activity) that is to be found. See CObjectName.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in queue.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of queues associated with the specified incident or activity. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<queues> + queue1..N + </queues>

where the XML schema for each queue is described by queue.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQueue proxy object
Microsoft.Crm.Platform.Proxy.CRMQueue  queue = new Microsoft.Crm.Platform.Proxy.CRMQueue();
queue.Credentials = System.Net.CredentialCache.DefaultCredentials;
queue.Url = strDir + "CRMQueue.srf";

string strErrorMsg;
string strQueueId = "{0961553A-D5DD-462E-AB11-C3750DC1A9F9}";
string strActivityId = "{33A081D8-ABFF-4103-9E9B-DB0A4B1FD48E}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strActivityId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otActivity;

   // Retrieve the queues that are assoicated with the activity
   string strQueueXml = queue.RetrieveByObject(userAuth, objName, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQueue Class
  • Retrieve


CRMQueue.RetrieveQueues Method

The RetrieveQueues method retrieves private, WipBin, or public queues for the specified business or organization.

Syntax

[Visual Basic .NET]
Public Function RetrieveQueues(
  ByVal Caller As CUserAuth,
  ByVal QueueTypeCode As QUEUE_TYPE_CODE(),
  ByVal UserId As String,
  ByVal Object As CObjectName,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveQueues(
  CUserAuth  Caller,
  QUEUE_TYPE_CODE[]  QueueTypeCode,
  string  UserId,
  CObjectName  Object,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveQueues(
  CUserAuth*  Caller,
  QUEUE_TYPE_CODE  QueueTypeCode __gc[],
  String*  UserId,
  CObjectName*  Object,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQueue privilege to perform this action. See CUserAuth.
QueueTypeCode
Specifies the types of queues that are to be retrieved. See QUEUE_TYPE_CODE.
UserId
Specifies the ID of the user for Private or WIP Bin queues.
Object
Specifies the public queue filter (BusinessUnit or Organization). See CObjectName.
ColumnSetXML
Specifies an XML string describing the queue. Passing "" or null returns all columns. You can find the valid column names in queue.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of queues associated with the specified business or organization. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<queues> + queue1..N + </queues>

where the XML schema for each queue is described by queue.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQueue proxy object
Microsoft.Crm.Platform.Proxy.CRMQueue  queue = new Microsoft.Crm.Platform.Proxy.CRMQueue();
queue.Credentials = System.Net.CredentialCache.DefaultCredentials;
queue.Url = strDir + "CRMQueue.srf";

string strErrorMsg;
string strBizID = "{0876468B-8FC4-4381-8D81-C0B4D05E9386}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strBizID;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otBusinessUnit;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Set the value for queue type
   Microsoft.Crm.Platform.Proxy.QUEUE_TYPE_CODE[] typecode = new Microsoft.Crm.Platform.Proxy.QUEUE_TYPE_CODE[1];
   typecode[0] = Microsoft.Crm.Platform.Proxy.QUEUE_TYPE_CODE.QTC_PUBLIC;

   // Retrieve the queues
   string strQueuesXml = queue.RetrieveQueues(userAuth, typecode, strUserId, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQueue Class
  • Retrieve


CRMQueue.Update Method

The Update method updates a public queue.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal QueueId As String,
  ByVal QueueXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  QueueId,
  string  QueueXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  QueueId,
  String*  QueueXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQueue privilege to perform this action. See CUserAuth.
QueueId
Specifies the ID of the queue that is to be updated.
QueueXML
Specifies an XML string representing the queue. The XML schema is described by queue.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQueue proxy object
Microsoft.Crm.Platform.Proxy.CRMQueue  queue = new Microsoft.Crm.Platform.Proxy.CRMQueue();
queue.Credentials = System.Net.CredentialCache.DefaultCredentials;
queue.Url = strDir + "CRMQueue.srf";

string strErrorMsg;
string strQueueId = "{0961553A-D5DD-462E-AB11-C3750DC1A9F9}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the queue
   strQueueXml = "<queue>";
   strQueueXml += "<name>Queue1</name>";
   strQueueXml += "</queue>";

   // Now update the queue
   queue.Update(userAuth, strQueueid, strQueueXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMQueue Class
  • UpdateAndRetrieve


CRMQueue.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a public queue and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal QueueId As String,
  ByVal QueueXML As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  QueueId,
  string  QueueXML,
  string  ColumnSetXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  QueueId,
  String*  QueueXML,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQueue and prvReadQueue privileges to perform this action. See CUserAuth.
QueueId
Specifies the ID of the queue that is to be updated.
QueueXML
Specifies an XML string representing the queue. The XML schema is described by queue.xsd.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in queue.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the queue. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by queue.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQueue proxy object
Microsoft.Crm.Platform.Proxy.CRMQueue  queue = new Microsoft.Crm.Platform.Proxy.CRMQueue();
queue.Credentials = System.Net.CredentialCache.DefaultCredentials;
queue.Url = strDir + "CRMQueue.srf";

string strErrorMsg;
string strQueueId = "{0961553A-D5DD-462E-AB11-C3750DC1A9F9}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string to update the queue
   strQueueXml = "<queue>";
   strQueueXml += "<name>Queue1</queue>";
   strQueueXml += "</queue>";

   // Now update and then retrieve the queue
   // Passing in an empty string for ColumnSet retrieves all columns
   string strResultXml = queue.UpdateAndRetrieve (userAuth, strQueueid, strQueueXml, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMQueue Class
  • Update


CRMQueueItem Class

The CRMQueueItem class contains methods that you can use to manage queue items.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMQueueItem
[Visual Basic .NET]
Public Class CRMQueueItem
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMQueueItem : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMQueueItem: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMQueueItem interface exposes the following methods.

Method | Description
RetrieveByQueue | Retrieves all queue items for an existing queue.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMQueueItem.RetrieveByQueue Method

The RetrieveByQueue method retrieves all queue items for an existing queue.

Syntax

[Visual Basic .NET]
Public Function RetrieveByQueue(
  ByVal Caller As CUserAuth,
  ByVal QueueId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByQueue(
  CUserAuth  Caller,
  string  QueueId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByQueue(
  CUserAuth*  Caller,
  String*  QueueId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQueue privilege to perform this action. See CUserAuth.
QueueId
Specifies the ID of the queue.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in queueitem.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of queue items associated with the queue. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<queueitems> + queueitem1..N + </queueitems>

where the XML schema for each queue item is described by queueitem.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQueueItem proxy object
Microsoft.Crm.Platform.Proxy.CRMQueueItem queueitem = new Microsoft.Crm.Platform.Proxy.CRMQueueItem();
queueitem.Credentials = System.Net.CredentialCache.DefaultCredentials;
queueitem.Url = strDir + "CRMQueueItem.srf";

string strErrorMsg;
string strQueueId = "{0961553A-D5DD-462E-AB11-C3750DC1A9F9}";
try
{

   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Retrieve the queue items for the queue
   string strQueueItemsXml = queueitem.RetrieveByQueue(userAuth, strQueueId, "");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQueueItem Class


CRMQuote Class

The CRMQuote class contains methods that you can use to manage quotes.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMQuote
[Visual Basic .NET]
Public Class CRMQuote
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMQuote : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMQuote: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMQuote class exposes the following methods.

Method | Description
Activate | Sets the state of a quote to Active.
Assign | Assigns a quote.
AssociateContact | Establishes an association between a contact and a quote.
Close | Sets the state of a quote to Closed.
ConvertToSalesOrder | Converts a quote to a sales order.
Create | Creates a quote.
CreateAndRetrieve | Creates a quote and then retrieves it.
Delete | Deletes a quote.
DisassociateContact | Eliminates the association between a contact and a quote.
GenerateFromOpportunity | Generates a quote from an opportunity.
GetProductsFromOpportunity | Retrieves the products from an opportunity and copies them to the quote.
GrantAccess | Grants a security principal access to a quote.
ModifyAccess | Replaces the access rights on the quote for the specified security principal.
Retrieve | Retrieves a quote.
RetrieveByObject | Retrieves all quotes that are associated with an object (account, contact, or opportunity).
RetrieveByPrincipal | Retrieves all quotes that are owned by a security principal (user or team).
RetrieveContacts | Retrieves all contacts that are associated with a quote.
RetrievePrincipalAccess | Retrieves the access a security principal has for the specified quote.
RetrieveSharedPrincipalsAndAccess | Retrieves all of the security principals (users or teams) that have access to a quote and their access rights for the quote.
Revise | Revises a quote.
RevokeAccess | Revokes the access a security principal has for a quote.
Update | Updates a quote.
UpdateAndRetrieve | Updates a quote and then retrieves it.
Win | Sets the state of a quote to Won.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMQuote.Activate Method

The Activate method sets the state of a quote to Active.

Syntax

[Visual Basic .NET]
Public Sub Activate(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal Status As Integer
)
[C#]
public void Activate(
  CUserAuth  Caller,
  string  QuoteId,
  int  Status
);
[C++]
public: void Activate(
  CUserAuth*  Caller,
  String*  QuoteId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQuote privilege to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
Status
Specifies the status of the quote. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Activate the quote
   quote.Activate (userAuth, strQuoteId, -1);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass


CRMQuote.Assign Method

The Assign method assigns the quote to a security principal (user or team). (See Remarks.) This method also applies to the parent object and associated objects that have the same owner as the parent object. Therefore when you assign the parent object to a new owner, only the associated objects that have the same owner as the parent object are assigned. In addition, when an object is assigned to a new owner, it is shared with the previous owner with full rights. Either the new owner or the previous owner can remove the relationship or lower the level of privileges the previous owner had on the object.

Syntax

[Visual Basic .NET]
Public Sub Assign(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal Assignee As CSecurityPrincipal
)
[C#]
public void Assign(
  CUserAuth  Caller,
  string  QuoteId,
  CSecurityPrincipal  Assignee
);
[C++]
public: void Assign(
  CUserAuth*  Caller,
  String*  QuoteId,
  CSecurityPrincipal*  Assignee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignQuote privilege to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
Assignee
Specifies the security principal (user or team) to whom the quote is to be assigned. See CSecurityPrincipal.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not support business-object assignment to teams. Therefore, any solutions built by using this method are not supported by the Microsoft CRM application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the quote to a security principal
   quote.Assign(userAuth, strQuoteId, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass


CRMQuote.AssociateContact Method

The AssociateContact method establishes an association between a contact and a quote.

Syntax

[Visual Basic .NET]
Public Sub AssociateContact(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal ContactId As String
)
[C#]
public void AssociateContact(
  CUserAuth  Caller,
  string  QuoteId,
  string  ContactId
);
[C++]
public: void AssociateContact(
  CUserAuth*  Caller,
  String*  QuoteId,
  String*  ContactId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendToQuote and prvAppendContact privileges to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
ContactId
Specifies the ID of the contact.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";
string strContactId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Associate the quote with a contact
   quote.AssociateContact(userAuth, strQuoteId, strContactId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass


CRMQuote.Close Method

The Close method sets the state of a quote to Closed.

Syntax

[Visual Basic .NET]
Public Sub Close(
  ByVal Caller As CUserAuth,
  ByVal ActivityXml As String,
  ByVal PartiesXml As String,
  ByVal Status As Integer
)
[C#]
public void Close(
  CUserAuth  Caller,
  string  ActivityXml,
  string  PartiesXml,
  int  Status
);
[C++]
public: void Close(
  CUserAuth*  Caller,
  String*  ActivityXml,
  String*  PartiesXml,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQuote privilege to perform this action. See CUserAuth.
ActivityXml
Specifies an XML string representing an activity. The XML schema is described by activity.xsd.
PartiesXml
Specifies an XML string representing activity parties. The XML schema is described by activityparty.xsd.
Status
Specifies the status of the quote. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";
string strActivity;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the activity
   strActivity = "<activity>" +
      "<objectid>" + strQuoteId + "</objectid>" +
      "<objecttypecode>" + (int)Microsoft.Crm.Platform.Types.ObjectType.otQuote.ToString() + "</objecttypecode>" +
      "<owninguser>" + userAuth.UserId + "</owninguser>" +
      "<activitytypecode>" + (int)Microsoft.Crm.Platform.Types.ObjectType.otQuoteCloseActivity.ToString() + "</activitytypecode>" +
      "</activity>";

   // Close the quote
   quote.Close(userAuth, strActivity, "", -1);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass


CRMQuote.ConvertToSalesOrder Method

The ConvertToSalesOrder method converts a quote to a sales order.

Syntax

[Visual Basic .NET]
Public Function ConvertToSalesOrder(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string ConvertToSalesOrder(
  CUserAuth  Caller,
  string  QuoteId,
  string  ColumnSetXml
);
[C++]
public: String* ConvertToSalesOrder(
  CUserAuth*  Caller,
  String*  QuoteId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvReadOrder and prvCreateOrder privileges to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesorder.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the new sales order. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by salesorder.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";
string strResultXml;
string strColumnSetXml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>salesorderid</column>";
   strColumnSetXml += "<column>customerid</column>";
   strColumnSetXml += "<column>ordernumber</column>";
   strColumnSetXml += "</columnset>";

   // Convert the quote to a sales order
   strResultXml = quote.ConvertToSalesOrder(userAuth, strQuoteId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass


CRMQuote.Create Method

The Create method creates a quote.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal QuoteXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  QuoteXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  QuoteXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateQuote privilege to perform this action. See Remarks for more information about privileges for this method. See CUserAuth.
QuoteXml
Specifies an XML string representing the quote. The XML schema is described by quote.xsd. See Remarks for more information about privileges for this method.

Return Value

Returns a String type that specifies the ID of the new quote.

Remarks

The ownerid field in the QuoteXml parameter has additional security requirements, which must be met for this method to succeed. The user who is specified in the ownerid field must have APPENDTO privileges on the account or the contract that is specified in the customerid field.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string xml;
string strCustomerId = "{CBDED4DD-CF90-43ED-85A9-0B33D205F9A6}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the quote
   xml = "<quote>";
   xml += "<name>Test Quote</name>";
   xml += "<customerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() +"\">";
   xml += strCustomerId + "</customerid>";
   xml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   xml += userAuth.UserId + "</ownerid>";
   xml += "</quote>";

   // Create the quote
   string strNewQuoteId = quote.Create (userAuth, xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMQuoteClass
  • Update


CRMQuote.CreateAndRetrieve Method

The CreateAndRetrieve method creates a quote and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InQuoteXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InQuoteXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InQuoteXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateQuote and prvReadQuote privileges to perform this action. See Remarks for more information about privileges for this method. See CUserAuth.
InQuoteXml
Specifies an XML string representing the quote. The XML schema is described by quote.xsd. See Remarks for more information about privileges for this method.

Return Value

Returns a String type that specifies the XML data containing the requested quote information. The XML schema is described by quote.xsd.

Remarks

The ownerid field in the InQuoteXml parameter has additional security requirements, which must be met for this method to succeed. The user who is specified in the ownerid field must have APPENDTO privileges on the account or the contract that is specified in the customerid field.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string xml;
string strCustomerId = "{CBDED4DD-CF90-43ED-85A9-0B33D205F9A6}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the quote
   xml = "<quote>";
   xml += "<name>Test Quote</name>";
   xml += "<customerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() +"\">";
   xml += strCustomerId + "</customerid>";
   xml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   xml += userAuth.UserId + "</ownerid>";
   xml += "</quote>";

   // Create the quote, and then retrieve the XML data for the quote
   string strQuoteXML = quote.CreateAndRetrieve(userAuth, xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMQuoteClass
  • UpdateAndRetrieve


CRMQuote.Delete Method

The Delete method deletes a quote.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  QuoteId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  QuoteId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteQuote privilege to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";
string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the quote
   quote.Delete (userAuth, strQuoteId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass


CRMQuote.DisassociateContact Method

The DisassociateContact method eliminates the association between a contact and a quote.

Syntax

[Visual Basic .NET]
Public Sub DisassociateContact(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal ContactId As String
)
[C#]
public void DisassociateContact(
  CUserAuth  Caller,
  string  QuoteId,
  string  ContactId
);
[C++]
public: void DisassociateContact(
  CUserAuth*  Caller,
  String*  QuoteId,
  String*  ContactId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendToQuote and prvAppendContact privileges to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
ContactId
Specifies the ID of the contact.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";
string strContactId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Disassociate the quote from the contact
   quote.DisassociateContact(userAuth, strQuoteId, strContactId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass


CRMQuote.GenerateFromOpportunity Method

The GenerateFromOpportunity method generates a quote from an opportunity.

Syntax

[Visual Basic .NET]
Public Function GenerateFromOpportunity(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string GenerateFromOpportunity(
  CUserAuth  Caller,
  string  OpportunityId,
  string  ColumnSetXml
);
[C++]
public: String* GenerateFromOpportunity(
  CUserAuth*  Caller,
  String*  OpportunityId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateQuote and prvReadOpportunity privileges to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in quote.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested quote information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by quote.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strOppId = "{C32FF898-53DB-4C8E-9D21-F534891BC816}";
string strColumnSetXml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Generate a quote from the opportunity
   string strResultXml = quote.GenerateFromOpportunity (userAuth, strOppId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass


CRMQuote.GetProductsFromOpportunity Method

The GetProductsFromOpportunity method retrieves the products from an opportunity and copies them to the quote.

Syntax

[Visual Basic .NET]
Public Sub GetProductsFromOpportunity(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal QuoteId As String
)
[C#]
public void GetProductsFromOpportunity(
  CUserAuth  Caller,
  string  OpportunityId,
  string  QuoteId
);
[C++]
public: void GetProductsFromOpportunity(
  CUserAuth*  Caller,
  String*  OpportunityId,
  String*  QuoteId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct and prvReadOpportunity privileges to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
QuoteId
Specifies the ID of the quote.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strOppId = "{C32FF898-53DB-4C8E-9D21-F534891BC816}";
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Get the products from an opportunity
   quote.GetProductsFromOpportunity (userAuth, strOppId, strQuoteId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuote Class


CRMQuote.GrantAccess Method

The GrantAccess method grants a security principal access to the specified quote. This method also applies to all child objects of the quote. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the quote. In this case, only the lack of privileges for a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub GrantAccess(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal Rights As UInt32,
  ByVal Principal As CSecurityPrincipal
)
[C#]
public void GrantAccess(
  CUserAuth  Caller,
  string  QuoteId,
  uint  Rights,
  CSecurityPrincipal  Principal
);
[C++]
public: void GrantAccess(
  CUserAuth*  Caller,
  String*  QuoteId,
  unsigned long  Rights,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareQuote privilege to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
Rights
Specifies the rights that are to be granted to the principal for the quote. See ACCESSRIGHTS.
Principal
Specifies the security principal (user or team) to whom access is to be granted. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set up the rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_WRITE;

   // Grant access to the quote
   quote.GrantAccess (userAuth, strQuoteId, rights, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass


CRMQuote.ModifyAccess Method

The ModifyAccess method replaces the access rights on the quote for the specified security principal. This method also applies to all child objects of the quote. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the quote. In this case, only the lack of privileges to a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub ModifyAccess(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal Rights As UInt32,
  ByVal Principal As CSecurityPrincipal
)
[C#]
public void ModifyAccess(
  CUserAuth  Caller,
  string  QuoteId,
  uint  Rights,
  CSecurityPrincipal  Principal
);
[C++]
public: void ModifyAccess(
  CUserAuth*  Caller,
  String*  QuoteId,
  unsigned long  Rights,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareQuote privilege to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
Rights
Specifies the rights that are to be granted to the principal for the quote. See ACCESSRIGHTS.
Principal
Specifies the security principal (user or team) to whom access is to be granted. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set up the rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_EXECUTE;

   // Modify access to the quote with the new rights
   quote.ModifyAccess (userAuth, strQuoteId, rights, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass


CRMQuote.Retrieve Method

The Retrieve method retrieves a quote by ID.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  QuoteId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  QuoteId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuote privilege to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in quote.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested quote information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by quote.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";
string strColumnSetXml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the quote
   string strResultXml = quote.Retrieve(userAuth, strQuoteId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass
  • RetrieveByObject
  • RetrieveByPrincipal
  • RetrieveContacts
  • RetrievePrincipalAccess
  • RetrieveSharedPrincipalsAndAccess


CRMQuote.RetrieveByObject Method

The RetrieveByObject method retrieves all quotes that are associated with an object (account, contact, or opportunity).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal StateCodes As Integer(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  int[]  StateCodes,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  long  StateCodes __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuote privilege to perform this action. See CUserAuth.
Object
Specifies the object (account, contact, or quote) for which you want to retrieve associated quotes. See CObjectName.
StateCodes
Specifies an array of state codes to find. See QUOTE_STATE.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in quote.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of quotes associated with the specified object (account, contact, or quote). The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<quotes> + quote1..N + </quotes>

where the XML schema for each quote is described by quote.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strColumnSetXml;
string strAccountId = "{CBDED4DD-CF90-43ED-85A9-0B33D205F9A6}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Initialize the account object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // An array of state codes to find
   int[] arrCodes = new int[] {Microsoft.Crm.Platform.Types.QUOTE_STATE.QS_DRAFT, Microsoft.Crm.Platform.Types.QUOTE_STATE.QS_ACTIVE};

   // Retrieve the quotes for the account
   string strResultsXml = quote.RetrieveByObject (userAuth, objName, arrCodes, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass
  • Retrieve


CRMQuote.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves all quotes that are owned by a security principal (user or team).

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal Principal As CSecurityPrincipal,
  ByVal StateCodes As Integer(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  Principal,
  int[]  StateCodes,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  Principal,
  long  StateCodes __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuote privilege to perform this action. See CUserAuth.
Principal
Specifies the security principal for which opportunities are to be retrieved. See CSecurityPrincipal.
StateCodes
Specifies an array of state codes to find. See QUOTE_STATE.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in quote.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of quotes requested. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<quotes> + quote1..N + </quotes>

where the XML schema for each quote is described by quote.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strColumnSetXml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // An array of state codes to find
   int[] arrCodes = new int[] {Microsoft.Crm.Platform.Types.INVOICE_STATE.INS_ACTIVE,Microsoft.Crm.Platform.Types.QUOTE_STATE.QS_ACTIVE};

   // Retrieve the quotes for this security principal
   string strResultsXml = quote.RetrieveByPrincipal (userAuth, securityPrincipal, arrCodes, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass
  • Retrieve


CRMQuote.RetrieveContacts Method

The RetrieveContacts method retrieves all contacts that are associated with a quote.

Syntax

[Visual Basic .NET]
Public Function RetrieveContacts(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveContacts(
  CUserAuth  Caller,
  string  QuoteId,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveContacts(
  CUserAuth*  Caller,
  String*  QuoteId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuote and prvReadContact privileges to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in quote.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of contacts requested. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<contacts> + contact1..N + </contacts>

where the XML schema for each contact is described by contact.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strColumnSetXml;
string strQuoteId="{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve all of the contacts
   string strResultsXml = quote.RetrieveContacts(userAuth, strQuoteId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteClass
  • Retrieve


CRMQuote.RetrievePrincipalAccess Method

The RetrievePrincipalAccess method retrieves the access a security principal has to the specified quote.

Syntax

[Visual Basic .NET]
Public Function RetrievePrincipalAccess(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal Principal As CSecurityPrincipal
) As UInt32
[C#]
public uint RetrievePrincipalAccess(
  CUserAuth  Caller,
  string  QuoteId,
  CSecurityPrincipal  Principal
);
[C++]
public: unsigned long RetrievePrincipalAccess(
  CUserAuth*  Caller,
  String*  QuoteId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuote privilege to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
Principal
Specifies the security principal for which access rights are to be retrieved. See CSecurityPrincipal.

Return Value

Returns a UInt32 type that specifies the rights the security principal has for the quote. See ACCESSRIGHTS.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve principal access
   uint access = quote.RetrievePrincipalAccess (userAuth, strQuoteId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuote Class
  • Retrieve


CRMQuote.RetrieveSharedPrincipalsAndAccess Method

The RetrieveSharedPrincipalsAndAccess method retrieves all of the security principals (users or teams) that have access to a quote and their access rights to that quote.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipalsAndAccess(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByRef Rights As UInt32()
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipalsAndAccess(
  CUserAuth  Caller,
  string  QuoteId,
  out uint[]  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipalsAndAccess(
  CUserAuth*  Caller,
  String*  QuoteId,
  unsigned long*  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuote privilege to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
Rights
[out] Specifies an array of rights for the principals. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type that specifies the array of security principals requested . See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

uint[] rights;
string strErrorMsg;
string strQuoteId="{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Initialize the security principals
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;

   // Retrieve shared principal access
   securityPrincipals = quote.RetrieveSharedPrincipalsAndAccess (userAuth, strQuoteId, out rights);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuote Class
  • Retrieve


CRMQuote.Revise Method

The Revise method revises a quote.

Syntax

[Visual Basic .NET]
Public Function Revise(
  ByVal Caller As CUserAuth,
  ByVal OriginalQuoteId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Revise(
  CUserAuth  Caller,
  string  OriginalQuoteId,
  string  ColumnSetXml
);
[C++]
public: String* Revise(
  CUserAuth*  Caller,
  String*  OriginalQuoteId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQuote privilege to perform this action. See CUserAuth.
OriginalQuoteId
Specifies the ID of the original quote.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in quote.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the revised quote information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by quote.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";
string strColumnSetXml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Revise the quote
   string strResultsXml = quote.Revise (userAuth, strQuoteId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuote Class


CRMQuote.RevokeAccess Method

The RevokeAccess method revokes access rights to the quote for the specified security principal. This method also applies to all child objects of the quote. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the quote. In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

Syntax

[Visual Basic .NET]
Public Sub RevokeAccess(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal Principal As CSecurityPrincipal
)
[C#]
public void RevokeAccess(
  CUserAuth  Caller,
  string  QuoteId,
  CSecurityPrincipal  Principal
);
[C++]
public: void RevokeAccess(
  CUserAuth*  Caller,
  String*  QuoteId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareQuote privilege to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
Principal
Specifies the security principal for which access is to be revoked. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Revoke access
   quote.RevokeAccess (userAuth, strQuoteId, securityPrincipal);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuote Class


CRMQuote.Update Method

The Update method updates a quote.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal QuoteXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  QuoteId,
  string  QuoteXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  QuoteId,
  String*  QuoteXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQuote privilege to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
QuoteXml
Specifies an XML string representing the quote. The XML schema is described by quote.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string xml;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the quote
   xml = "<quote>";
   xml += "<name>Test Quote changed</name>";
   xml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   xml += userAuth.UserId + "</ownerid>";
   xml += "</quote>";

   // Update the quote
   quote.Update(userAuth,strQuoteId,xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMQuote Class
  • UpdateAndRetrieve


CRMQuote.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a quote and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal InQuoteXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  QuoteId,
  string  InQuoteXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  QuoteId,
  String*  InQuoteXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQuote and prvReadQuote privileges to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
InQuoteXml
Specifies an XML string representing the quote. The XML schema is described by quote.xsd.

Return Value

Returns a String type that specifies the XML data containing the requested quote information. The XML schema is described by quote.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string xml;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the quote
   xml = "<quote>";
   xml += "<name>Test Quote changed</name>";
   xml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   xml += userAuth.UserId + "</ownerid>";
   xml += "</quote>";

   // Update the quote, and then retrieve it
   string strResultsXml = quote.UpdateAndRetrieve (userAuth, strQuoteId, xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMQuote Class
  • Update


CRMQuote.Win Method

The Win method sets the state of a quote to Won.

Syntax

[Visual Basic .NET]
Public Sub Win(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal Status As Integer
)
[C#]
public void Win(
  CUserAuth  Caller,
  string  QuoteId,
  int  Status
);
[C++]
public: void Win(
  CUserAuth*  Caller,
  String*  QuoteId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQuote privilege to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
Status
Specifies the status of the quote. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuote proxy object
Microsoft.Crm.Platform.Proxy.CRMQuote   quote = new Microsoft.Crm.Platform.Proxy.CRMQuote();
quote.Credentials = System.Net.CredentialCache.DefaultCredentials;
quote.Url = strDir + "CRMQuote.srf";

string strErrorMsg;
string strQuoteId = "{21AE236A-2A82-4064-AEEC-DD6BAF90C29E}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Change the state of the quote to Won
   quote.Win (userAuth, strQuoteId, -1);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuote Class


CRMQuoteDetail Class

The CRMQuoteDetail class contains methods that you can use to manage quote details.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMQuoteDetail
[Visual Basic .NET]
Public Class CRMQuoteDetail
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMQuoteDetail : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMQuoteDetail: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMQuoteDetail class exposes the following methods.

Method | Description
Create | Creates a quote detail.
CreateAndRetrieve | Creates a quote detail and then retrieves it.
Delete | Deletes a quote detail.
GetQuantityDecimal | Retrieves the quantity decimal value for a product.
Retrieve | Retrieves a quote detail.
RetrieveByObject | Retrieves all quote details that are associated with an object (quote).
Update | Updates a quote detail.
UpdateAndRetrieve | Updates a quote detail and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMQuoteDetail.Create Method

The Create method creates a quote detail.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal QuoteDetailXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  QuoteDetailXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  QuoteDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateQuote and prvAppendToQuote privileges to perform this action. See CUserAuth.
QuoteDetailXml
Specifies an XML string representing the quote detail. The XML schema is described by quotedetail.xsd.

Return Value

Returns a String type that specifies the ID of the quote detail.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuoteDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMQuoteDetail    quotedetail = new Microsoft.Crm.Platform.Proxy.CRMQuoteDetail ();
quotedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
quotedetail.Url = strDir + "CRMQuoteDetail.srf";

string strErrorMsg;
string strQuoteId = "{3D043FA7-A683-404F-8DB9-3801296759D1}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the quote detail
   string xml = " <quotedetail>";
   xml += "<description>Test Quote Detail</description>";
   xml += "<quoteid>" + strQuoteId + "</quoteid>";
   xml += "</quotedetail>";

   // Create the quote detail
   string strQuoteDetailId = quotedetail.Create (userAuth, xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMQuoteDetail Class
  • Update


CRMQuoteDetail.CreateAndRetrieve Method

The CreateAndRetrieve method creates a quote detail and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InQuoteDetailXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InQuoteDetailXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InQuoteDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateQuote, prvAppendToQuote, and prvReadQuote privileges to perform this action. See CUserAuth.
InQuoteDetailXml
Specifies an XML string representing the quote detail. The XML schema is described by quotedetail.xsd.

Return Value

Returns a String type that specifies the XML data containing the requested quote detail information. The XML schema is described by quotedetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuoteDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMQuoteDetail quotedetail = new Microsoft.Crm.Platform.Proxy.CRMQuoteDetail ();
quotedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
quotedetail.Url = strDir + "CRMQuoteDetail.srf";

string strErrorMsg;
string strQuoteId = "{3D043FA7-A683-404F-8DB9-3801296759D1}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the quote detail
   string xml = " <quotedetail>";
   xml += "<description>Test Quote Detail</description>";
   xml += "<quoteid>" + strQuoteId + "</quoteid>";
   xml += "</quotedetail>";

   // Create the quote detail, and then retrieve it
   string strQuoteDetailXml = quotedetail.CreateAndRetrieve (userAuth, xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMQuoteDetail Class
  • UpdateAndRetrieve


CRMQuoteDetail.Delete Method

The Delete method deletes a quote detail.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal QuoteDetailId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  QuoteDetailId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  QuoteDetailId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteQuote privilege to perform this action. See CUserAuth.
QuoteDetailId
Specifies the ID of the quote detail.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuoteDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMQuoteDetail quotedetail = new Microsoft.Crm.Platform.Proxy.CRMQuoteDetail ();
quotedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
quotedetail.Url = strDir + "CRMQuoteDetail.srf";

string strErrorMsg;
string strQuoteDetailId = "{A0A99152-9A24-414C-BC2E-5DA77844C156}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the quote detail
   quotedetail.Delete (userAuth, strQuoteDetailId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteDetail Class


CRMQuoteDetail.GetQuantityDecimal Method

The GetQuantityDecimal method retrieves the quantity decimal value for a product.

Syntax

[Visual Basic .NET]
Public Function GetQuantityDecimal(
  ByVal Caller As CUserAuth,
  ByVal QuoteId As String,
  ByVal ProductId As String,
  ByVal UoMId As String
) As Integer
[C#]
public int GetQuantityDecimal(
  CUserAuth  Caller,
  string  QuoteId,
  string  ProductId,
  string  UoMId
);
[C++]
public: long GetQuantityDecimal(
  CUserAuth*  Caller,
  String*  QuoteId,
  String*  ProductId,
  String*  UoMId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuote privilege to perform this action. See CUserAuth.
QuoteId
Specifies the ID of the quote.
ProductId
Specifies the ID of the product.
UoMId
Specifies the ID of the unit of measure.

Return Value

Returns an Int32 type that specifies the quantity decimal value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuoteDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMQuoteDetail    quotedetail = new Microsoft.Crm.Platform.Proxy.CRMQuoteDetail ();
quotedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
quotedetail.Url = strDir + "CRMQuoteDetail.srf";

string strErrorMsg;
string strQuoteId = "{3D043FA7-A683-404F-8DB9-3801296759D1}";
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";
string strUoMId = "{E0B38CBE-91BB-4863-8F4F-76785CE705D2}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Get the quantity decimal value
   quotedetail.GetQuantityDecimal (userAuth, strQuoteId, strProductId, strUoMId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteDetail Class


CRMQuoteDetail.Retrieve Method

The Retrieve method retrieves a quote detail.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal QuoteDetailId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  QuoteDetailId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  QuoteDetailId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuote privilege to perform this action. See CUserAuth.
QuoteDetailId
Specifies the ID of the quote detail.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in quotedetail.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested quote detail information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by quotedetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuoteDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMQuoteDetail    quotedetail = new Microsoft.Crm.Platform.Proxy.CRMQuoteDetail ();
quotedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
quotedetail.Url = strDir + "CRMQuoteDetail.srf";

string strErrorMsg;
string strQuoteDetailId = "{A0A99152-9A24-414C-BC2E-5DA77844C156}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the quote detail
   string quoteDetailXml = quotedetail.Retrieve (userAuth, strQuoteDetailId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteDetail Class
  • RetrieveByObject


CRMQuoteDetail.RetrieveByObject Method

The RetrieveByObject method retrieves all quote details that are associated with an object (quote).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadQuote privilege to perform this action. See CUserAuth.
Object
Specifies the object (quote) for which you want to retrieve the associated quote details. See CObjectName.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in quotedetail.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of quote details associated with the specified quote object. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<quotedetails> + quotedetail1..N + </quotedetails>

where the XML schema for each quote detail is described by quotedetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuoteDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMQuoteDetail    quotedetail = new Microsoft.Crm.Platform.Proxy.CRMQuoteDetail ();
quotedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
quotedetail.Url = strDir + "CRMQuoteDetail.srf";

string strErrorMsg;
string strQuoteId = "{3D043FA7-A683-404F-8DB9-3801296759D1}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Initialize the quote object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strQuoteId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otQuote;

   // Retrieve quote details for the quote
   string strResultsXml = quotedetail.RetrieveByObject (userAuth, objName, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMQuoteDetail Class
  • Retrieve


CRMQuoteDetail.Update Method

The Update method updates a quote detail.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal QuoteDetailId As String,
  ByVal QuoteDetailXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  QuoteDetailId,
  string  QuoteDetailXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  QuoteDetailId,
  String*  QuoteDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQuote privilege to perform this action. See CUserAuth.
QuoteDetailId
Specifies the ID of the quote detail that is to be updated.
QuoteDetailXml
Specifies an XML string representing the quote detail. The XML schema is described by quotedetail.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuoteDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMQuoteDetail    quotedetail = new Microsoft.Crm.Platform.Proxy.CRMQuoteDetail ();
quotedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
quotedetail.Url = strDir + "CRMQuoteDetail.srf";

string strErrorMsg;
string strQuoteDetailId = "{A0A99152-9A24-414C-BC2E-5DA77844C156}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the quote detail
   string xml = " <quotedetail>";
   xml += "<description>Test Quote Detail 1</description>";
   xml += "</quotedetail>";

   // Update the quote detail
   quotedetail.Update (userAuth, strQuoteDetailId, xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMQuoteDetail Class
  • UpdateAndRetrieve


CRMQuoteDetail.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a quote detail and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal QuoteDetailId As String,
  ByVal InQuoteDetailXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  QuoteDetailId,
  string  InQuoteDetailXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  QuoteDetailId,
  String*  InQuoteDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteQuote and prvReadQuote privileges to perform this action. See CUserAuth.
QuoteDetailId
Specifies the ID of the quote detail that is to be updated.
InQuoteDetailXml
Specifies an XML string representing the quote detail. The XML schema is described by quotedetail.xsd.

Return Value

Returns a String type that specifies the XML data containing the requested quote detail information. The XML schema is described by quotedetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMQuoteDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMQuoteDetail quotedetail = new Microsoft.Crm.Platform.Proxy.CRMQuoteDetail ();
quotedetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
quotedetail.Url = strDir + "CRMQuoteDetail.srf";

string strErrorMsg;
string strQuoteDetailId = "{A0A99152-9A24-414C-BC2E-5DA77844C156}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the quote detail
   string xml = " <quotedetail>";
   xml += "<description>Test Quote Detail 1</description>";
   xml += "</quotedetail>";

   // Update the quote detail, and then retrieve it
   string strResultsXml = quotedetail.UpdateAndRetrieve (userAuth, strQuoteDetailId, xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMQuoteDetail Class
  • Update


CRMRichClientSync Class

The CRMRichClientSync class contains methods that you can use to prepare data for synchronization with Microsoft CRM Sales for Outlook. See also Synchronization with Microsoft CRM Sales for Outlook.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMRichClientSync
[Visual Basic .NET]
Public Class CRMRichClientSync
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMRichClientSync : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMRichClientSync: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMRichClientSync class exposes the following methods.

Method | Description
CreateSubscription | Creates a subscription. A subscription allows a user on a specific computer to go offline by using the Outlook client.
EndSync | Ends an offline synchronization operation.
GetDatabaseInfo | Gets the database information for Microsoft SQL Server replication.
PrepareSync | Prepares an offline synchronization operation. This method creates a list of objects that a specific user can see (which correspond to the user's privileges) and that is downloaded later in the synchronization cycle.
ReinitializeSubscription | Re-initializes a subscription.
RemoveSubscription | Removes a subscription.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMRichClientSync.CreateSubscription Method

The CreateSubscription method creates a subscription. A subscription allows a user on a specific computer to go offline by using the Microsoft CRM Sales for Outlook client.

Syntax

[Visual Basic .NET]
Public Function CreateSubscription(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal MachineName As String
) As String
[C#]
public string CreateSubscription(
  CUserAuth  Caller,
  string  UserId,
  string  MachineName
);
[C++]
public: String* CreateSubscription(
  CUserAuth*  Caller,
  String*  UserId,
  String*  MachineName
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrganization, prvReadBusinessUnit, prvReadUser, prvReadUserSettings, prvReadTeam, prvReadRole, and prvReadLicense privileges to perform this action. See CUserAuth.
UserId
Specifies the ID of the user.
MachineName
Specifies the name of the Outlook client computer.

Return Value

Returns a String type that specifies the ID of the new subscription.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMRichClientSync proxy object
Microsoft.Crm.Platform.Proxy.CRMRichClientSync richclientsync = new Microsoft.Crm.Platform.Proxy.CRMRichClientSync();
richclientsync.Credentials = System.Net.CredentialCache.DefaultCredentials;
richclientsync.Url = strDir + "CRMRichclientsync..srf";

string strErrorMsg;
string UserId = "{34EAEC97-AK8E-6671-9022-7DKCFBD0F0E3}";
string strMName = "localmachine";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Create a subscription
   string strSubscriptionId = richclientsync.CreateSubscription(userAuth, UserId, strMName);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMRichClientSync Class


CRMRichClientSync.EndSync Method

The EndSync method ends an offline synchronization operation.

Syntax

[Visual Basic .NET]
Public Sub EndSync(
  ByVal Caller As CUserAuth,
  ByVal SubscriptionId As String
)
[C#]
public void EndSync(
  CUserAuth  Caller,
  string  SubscriptionId
);
[C++]
public: void EndSync(
  CUserAuth*  Caller,
  String*  SubscriptionId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrganization, prvReadBusinessUnit, prvReadUser, prvReadUserSettings, prvReadTeam, prvReadRole, and prvReadLicense privileges to perform this action. See CUserAuth.
SubscriptionId
Specifies the ID of the subscription.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMRichClientSync proxy object
Microsoft.Crm.Platform.Proxy.CRMRichClientSync richclientsync = new Microsoft.Crm.Platform.Proxy.CRMRichClientSync();
richclientsync.Credentials = System.Net.CredentialCache.DefaultCredentials;
richclientsync.Url = strDir + "CRMRichclientsync..srf";

string strErrorMsg;
string strSubscriptionId = "{57ELDC97-KL8E-3371-9022-7DKCFBD0F0E3}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // End the synchronization
   richclientsync.EndSync(userAuth, strSubscriptionId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMRichClientSync Class


CRMRichClientSync.GetDatabaseInfo Method

The GetDatabaseInfo method gets the database information for Microsoft SQL Server replication.

Syntax

[Visual Basic .NET]
Public Function GetDatabaseInfo(
  ByVal Caller As CUserAuth,
  ByRef MetabaseName As String,
  ByRef DatabaseName As String
) As String
[C#]
public string GetDatabaseInfo(
  CUserAuth  Caller,
  out string  MetabaseName,
  out string  DatabaseName
);
[C++]
public: String* GetDatabaseInfo(
  CUserAuth*  Caller,
  String**  MetabaseName,
  String**  DatabaseName
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrganization, prvReadBusinessUnit, prvReadUser, prvReadUserSettings, prvReadTeam, prvReadRole, and prvReadLicense privileges to perform this action. See CUserAuth.
MetabaseName
[out] Specifies the name of the metabase.
DatabaseName
[out] Specifies the name of the database.

Return Value

Returns a String type that specifies the name of the computer on which the database is located.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMRichClientSync proxy object
Microsoft.Crm.Platform.Proxy.CRMRichClientSync richclientsync = new Microsoft.Crm.Platform.Proxy.CRMRichClientSync();
richclientsync.Credentials = System.Net.CredentialCache.DefaultCredentials;
richclientsync.Url = strDir + "CRMRichclientsync..srf";

string strErrorMsg;
string strMetaName = "MetaName";
string strDatabaseName = "master";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Get the database information
   string strDatabaseInfo = richclientsync.GetDatabaseInfo (userAuth, out strMetaName, out strDatabaseName);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMRichClientSync Class


CRMRichClientSync.PrepareSync Method

The PrepareSync method prepares an offline synchronization operation. This method creates a list of objects that a specific user can see (which correspond to the user's privileges) and that is downloaded later in the synchronization cycle.

Syntax

[Visual Basic .NET]
Public Function PrepareSync(
  ByVal Caller As CUserAuth,
  ByVal SubscriptionId As String,
  ByVal IncludeAttachments As Integer,
  ByVal SyncBusinessUnitOnly As Integer,
  ByVal MaxSalesLiteratureSize As UInt32,
  ByVal SalesLiteratureItems As String,
  ByVal LastSync As String,
  ByRef UserInfo As Byte()
) As String
[C#]
public string PrepareSync(
  CUserAuth  Caller,
  string  SubscriptionId,
  int  IncludeAttachments,
  int  SyncBusinessUnitOnly,
  uint  MaxSalesLiteratureSize,
  string  SalesLiteratureItems,
  string  LastSync,
  out byte[]  UserInfo
);
[C++]
public: String* PrepareSync(
  CUserAuth*  Caller,
  String*  SubscriptionId,
  long  IncludeAttachments,
  long  SyncBusinessUnitOnly,
  unsigned long  MaxSalesLiteratureSize,
  String*  SalesLiteratureItems,
  String*  LastSync,
  unsigned char*  UserInfo
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrganization, prvReadBusinessUnit, prvReadUser, prvReadUserSettings, prvReadTeam, prvReadRole, and prvReadLicense privileges to perform this action. See CUserAuth.
SubscriptionId
Specifies the ID of the subscription.
IncludeAttachments
Specifies whether to include attachments when performing the synchronization.
SyncBusinessUnitOnly
Specifies whether to synchronize only the business unit.
MaxSalesLiteratureSize
Specifies the maximum size of the sales literature items that are to be synchronized.
SalesLiteratureItems
Specifies sales literature items.
LastSync
Specifies the time of the last synchronization.
UserInfo
[out] Specifies the user security credentials. The Outlook client stores this binary data in the database, which is then used by offline security for access checks.

Return Value

Returns a String type that specifies the returned time of this synchronization.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMRichClientSync proxy object
Microsoft.Crm.Platform.Proxy.CRMRichClientSync richclientsync = new Microsoft.Crm.Platform.Proxy.CRMRichClientSync();
richclientsync.Credentials = System.Net.CredentialCache.DefaultCredentials;
richclientsync.Url = strDir + "CRMRichclientsync..srf";

string strErrorMsg;
string strSubscriptionId = "{57ELDC97-KL8E-3371-9022-7DKCFBD0F0E3}";
string strSalesLiteratureItemIds = "{CD079251-CD0E-4154-B0D6-8062D2C98C1D},{0961553A-D5DD-462E-AB11-C3750DC1A9F9}";
string strDate = DateTime.Now.AddDays(-5).ToString("s");

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   byte[] uInfo;

   // Prepare the synchronization process
   richclientsync.PrepareSync(userAuth, strSubscriptionId, 1, 1, 16384, strSalesLiteratureItemIds, strDate, out uInfo);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMRichClientSync Class


CRMRichClientSync.ReinitializeSubscription Method

The ReinitializeSubscription method re-initializes a subscription.

Syntax

[Visual Basic .NET]
Public Sub ReinitializeSubscription(
  ByVal Caller As CUserAuth,
  ByVal SubscriptionId As String
)
[C#]
public void ReinitializeSubscription(
  CUserAuth  Caller,
  string  SubscriptionId
);
[C++]
public: void ReinitializeSubscription(
  CUserAuth*  Caller,
  String*  SubscriptionId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrganization, prvReadBusinessUnit, prvReadUser, prvReadUserSettings, prvReadTeam, prvReadRole, and prvReadLicense privileges to perform this action. See CUserAuth.
SubscriptionId
Specifies the ID of the subscription.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMRichClientSync proxy object
Microsoft.Crm.Platform.Proxy.CRMRichClientSync richclientsync = new Microsoft.Crm.Platform.Proxy.CRMRichClientSync();
richclientsync.Credentials = System.Net.CredentialCache.DefaultCredentials;
richclientsync.Url = strDir + "CRMRichclientsync..srf";

string strErrorMsg;
string strSubscriptionId = "{57ELDC97-KL8E-3371-9022-7DKCFBD0F0E3}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Re-initialize the subscription
   richclientsync.ReinitializeSubscription (userAuth, strSubscriptionId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMRichClientSync Class


CRMRichClientSync.RemoveSubscription Method

The RemoveSubscription method removes a subscription.

Syntax

[Visual Basic .NET]
Public Sub RemoveSubscription(
  ByVal Caller As CUserAuth,
  ByVal SubscriptionId As String
)
[C#]
public void RemoveSubscription(
  CUserAuth  Caller,
  string  SubscriptionId
);
[C++]
public: void RemoveSubscription(
  CUserAuth*  Caller,
  String*  SubscriptionId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrganization, prvReadBusinessUnit, prvReadUser, prvReadUserSettings, prvReadTeam, prvReadRole, and prvReadLicense privileges to perform this action. See CUserAuth.
SubscriptionId
Specifies the ID of the subscription.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMRichClientSync proxy object
Microsoft.Crm.Platform.Proxy.CRMRichClientSync richclientsync = new Microsoft.Crm.Platform.Proxy.CRMRichClientSync();
richclientsync.Credentials = System.Net.CredentialCache.DefaultCredentials;
richclientsync.Url = strDir + "CRMRichclientsync..srf";

string strErrorMsg;
string strSubscriptionId = "{57ELDC97-KL8E-3371-9022-7DKCFBD0F0E3}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Remove the subscription
   richclientsync.RemoveSubscription (userAuth, strSubscriptionId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMRichClientSync Class


CRMSalesLiterature Class

The CRMSalesLiterature class contains methods that you can use to manage a library of sales literature objects. A sales literature object is a container for one or more sales literature items. See CRMSalesLiteratureItem.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMSalesLiterature
[Visual Basic .NET]
Public Class CRMSalesLiterature
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMSalesLiterature : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMSalesLiterature: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMSalesLiterature class exposes the following methods.

Method | Description
Create | Creates a sales literature object.
CreateAndRetrieve | Creates a sales literature object and then retrieves it.
Delete | Deletes a sales literature object.
RemoveAssociation | Removes the association of the sales literature object with another object (product or competitor).
Retrieve | Retrieves a sales literature object by ID.
RetrieveByObject | Retrieves all sales literature objects that are associated with the specified object (product or competitor).
SetAssociation | Establishes an association between a sales literature object and another object (product or competitor).
Update | Updates a sales literature object.
UpdateAndRetrieve | Updates a sales literature object and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMSalesLiterature.Create Method

The Create method creates a sales literature object.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal EntityXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  EntityXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  EntityXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateSalesLiterature privilege to perform this action. See CUserAuth.
EntityXML
Specifies an XML string describing the new sales literature object. The XML schema is described by salesliterature.xsd.

Return Value

Returns a String type that specifies the ID of the newly created sales literature object.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiterature proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiterature salesliterature = new Microsoft.Crm.Platform.Proxy.CRMSalesLiterature();
salesliterature.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliterature.Url = strDir + "CRMSalesLiterature.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the sales literature XML string
   string strSalesLiteratureXml = "<salesliterature>";
   strSalesLiteratureXml += "<name>name1</name>";
   strSalesLiteratureXml += "<description>description1</description>";
   strSalesLiteratureXml += "</salesliterature>";

   // Now create the sales literature object
   string strSalesLitId = salesliterature.Create(userAuth, strSalesLiteratureXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMSalesLiterature Class
  • Update


CRMSalesLiterature.CreateAndRetrieve Method

The CreateAndRetrieve method creates a sales literature object and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityXml As String,
  ByVal ColumnSet As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  EntityXml,
  string  ColumnSet
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  EntityXml,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateSalesLiterature and prvReadSalesLiterature privileges to perform this action. See CUserAuth.
EntityXml
Specifies an XML string describing the new sales literature object. The XML schema is described by salesliterature.xsd.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesliterature.xsd.

Return Value

Returns a String type that specifies the XML data describing the newly created sales literature object. The XML schema is described by salesliterature.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiterature proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiterature salesliterature = new Microsoft.Crm.Platform.Proxy.CRMSalesLiterature();
salesliterature.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliterature.Url = strDir + "CRMSalesLiterature.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the sales literature XML string
   string strSalesLiteratureXml = "<salesliterature>";
   strSalesLiteratureXml += "<name>name1</name>";
   strSalesLiteratureXml += "<description>description1</description>";
   strSalesLiteratureXml += "</salesliterature>";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Create and then retrieve the sales literature object
   string strNewSalesLiteratureXml = salesliterature.CreateAndRetrieve(userAuth, strSalesLiteratureXml, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMSalesLiterature Class
  • UpdateAndRetrieve


CRMSalesLiterature.Delete Method

The Delete method deletes a sales literature object.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  EntityId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  EntityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteSalesLiterature privilege to perform this action. See CUserAuth.
EntityId
Specifies ID of the sales literature object that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiterature proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiterature salesliterature = new Microsoft.Crm.Platform.Proxy.CRMSalesLiterature();
salesliterature.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliterature.Url = strDir + "CRMSalesLiterature.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureId = "{706D1D72-CF08-40CD-8059-CC0DF6377A19}";

   // Now delete the sales literature object
   salesliterature.Delete(userAuth, strSalesLiteratureId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesLiterature Class


CRMSalesLiterature.RemoveAssociation Method

The RemoveAssociation method removes the association between a sales literature object and another object (product or competitor).

Syntax

[Visual Basic .NET]
Public Sub RemoveAssociation(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal Object As CObjectName
)
[C#]
public void RemoveAssociation(
  CUserAuth  Caller,
  string  EntityId,
  CObjectName  Object
);
[C++]
public: void RemoveAssociation(
  CUserAuth*  Caller,
  String*  EntityId,
  CObjectName*  Object
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendSalesLiterature privilege and the prvAppendToCompetitor or prvAppendToProduct privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the sales literature object.
Object
Specifies the object (product or competitor) that is to be disassociated from the specified sales literature object. See CObjectName.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiterature proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiterature salesliterature = new Microsoft.Crm.Platform.Proxy.CRMSalesLiterature();
salesliterature.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliterature.Url = strDir + "CRMSalesLiterature.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureId = "{706D1D72-CF08-40CD-8059-CC0DF6377A19}";
   string strProductId = "{236BCC84-7570-40C8-8F1E-3092A62B06BA}";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strProductId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otProduct;

   // Set an association with the product
   salesliterature.SetAssociation(userAuth, strSalesLiteratureId, objName);

   // Now remove the association with the product
   salesliterature.RemoveAssociation(userAuth, strSalesLiteratureId, objName);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesLiterature Class
  • SetAssociation


CRMSalesLiterature.Retrieve Method

The Retrieve method retrieves a sales literature object by ID.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  EntityId,
  string  ColumnSet
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadSalesLiterature privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the sales literature object.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesliterature.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the sales literature object. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by salesliterature.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiterature proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiterature salesliterature = new Microsoft.Crm.Platform.Proxy.CRMSalesLiterature();
salesliterature.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliterature.Url = strDir + "CRMSalesLiterature.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureId = "{706D1D72-CF08-40CD-8059-CC0DF6377A19}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Now retrieve the sales literature
   string strSalesLitXml = salesliterature.Retrieve(userAuth, strSalesLiteratureId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesLiterature Class
  • RetrieveByObject


CRMSalesLiterature.RetrieveByObject Method

The RetrieveByObject method retrieves all sales literature objects that are associated with the specified object (product or competitor).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSet
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadSalesLiterature privilege to perform this action. See CUserAuth.
Object
Specifies the object (product or competitor). See CObjectName.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesliterature.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of sales literature objects associated with the specified product or competitor. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<salesliteratures> + salesliterature1..N + </salesliteratures>

where the XML schema for each sales literature object is described by salesliterature.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiterature proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiterature salesliterature = new Microsoft.Crm.Platform.Proxy.CRMSalesLiterature();
salesliterature.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliterature.Url = strDir + "CRMSalesLiterature.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strProductId = "{236BCC84-7570-40C8-8F1E-3092A62B06BA}";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strProductId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otProduct;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Now retrieve the sales literature by product
   string strResultsXml = salesliterature.RetrieveByObject(userAuth, objName, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesLiterature Class
  • Retrieve


CRMSalesLiterature.SetAssociation Method

The SetAssociation method establishes an association between a sales literature object and another object (product or competitor).

Syntax

[Visual Basic .NET]
Public Sub SetAssociation(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal Object As CObjectName
)
[C#]
public void SetAssociation(
  CUserAuth  Caller,
  string  EntityId,
  CObjectName  Object
);
[C++]
public: void SetAssociation(
  CUserAuth*  Caller,
  String*  EntityId,
  CObjectName*  Object
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendSalesLiterature privilege and the prvAppendToCompetitor or the prvAppendToProduct privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the sales literature object.
Object
Specifies the object that is to be associated with the specified sales literature object (product or competitor). See CObjectName.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiterature proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiterature salesliterature = new Microsoft.Crm.Platform.Proxy.CRMSalesLiterature();
salesliterature.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliterature.Url = strDir + "CRMSalesLiterature.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureId = "{706D1D72-CF08-40CD-8059-CC0DF6377A19}";
   string strProductId = "{236BCC84-7570-40C8-8F1E-3092A62B06BA}";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strProductId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otProduct;

   // Set the association with the product
   salesliterature.SetAssociation(userAuth, strSalesLiteratureId, objName);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesLiterature Class
  • RemoveAssociation


CRMSalesLiterature.Update Method

The Update method updates a sales literature object.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal EntityXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  EntityId,
  string  EntityXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  EntityXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteSalesLiterature privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the sales literature object that is to be updated.
EntityXml
Specifies an XML string describing the updated sales literature object. The XML schema is described by salesliterature.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiterature proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiterature salesliterature = new Microsoft.Crm.Platform.Proxy.CRMSalesLiterature();
salesliterature.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliterature.Url = strDir + "CRMSalesLiterature.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureId = "{706D1D72-CF08-40CD-8059-CC0DF6377A19}";

   string strSalesLiteratureXml = "<salesliterature>";
   strSalesLiteratureXml += "<name>name2</name>";
   strSalesLiteratureXml += "<description>description2</description>";
   strSalesLiteratureXml += "</salesliterature>";

   // Now update the sales sales literature
   salesliterature.Update(userAuth, strSalesLiteratureId, strSalesLiteratureXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMSalesLiterature Class
  • UpdateAndRetrieve


CRMSalesLiterature.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a sales literature object and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal EntityXml As String,
  ByVal ColumnSet As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  EntityId,
  string  EntityXml,
  string  ColumnSet
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  EntityXml,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvWriteSalesLiterature and prvReadSalesLiterature privileges to perform this action. See CUserAuth.
EntityId
Specifies the ID of the sales literature object that is to be updated.
EntityXml
Specifies an XML string describing the updated sales literature object. The XML schema is described by salesliterature.xsd.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesliterature.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the updated sales literature object. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by salesliterature.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiterature proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiterature salesliterature = new Microsoft.Crm.Platform.Proxy.CRMSalesLiterature();
salesliterature.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliterature.Url = strDir + "CRMSalesLiterature.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureId = "{706D1D72-CF08-40CD-8059-CC0DF6377A19}";

   // Set up the sales literature XML string
   string strSalesLiteratureXml = "<salesliterature>";
   strSalesLiteratureXml += "<name>name2</name>";
   strSalesLiteratureXml += "<description>description2</description>";
   strSalesLiteratureXml += "</salesliterature>";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "</columnset>";

   // Now update the sales literature object
   string strNewSalesXml = salesliterature.UpdateAndRetrieve(userAuth, strSalesLiteratureId, strSalesLiteratureXml, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMSalesLiterature Class
  • Update


CRMSalesLiteratureItem Class

The CRMSalesLiteratureItem class contains methods that you can use to manage items in a sales literature object. See CRMSalesLiterature.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMSalesLiteratureItem
[Visual Basic .NET]
Public Class CRMSalesLiteratureItem
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMSalesLiteratureItem : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMSalesLiteratureItem: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMSalesLiteratureItem class exposes the following methods.

Method | Description
Create | Creates a sales literature item.
CreateAndRetrieve | Creates a sales literature item and then retrieves it.
Delete | Deletes a sales literature item.
RemoveBinaryData | Removes an attachment from a sales literature item.
Retrieve | Retrieves a sales literature item by ID.
RetrieveByObject | Retrieves all sales literature items that are associated with an object (sales literature).
Update | Updates a sales literature item.
UpdateAndRetrieve | Updates a sales literature item and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMSalesLiteratureItem.Create Method

The Create method creates a sales literature item.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal EntityXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  EntityXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  EntityXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateSalesLiterature privilege to perform this action. See CUserAuth.
EntityXML
Specifies an XML string describing the new sales literature item. The XML schema is described by salesliteratureitem.xsd.

Return Value

Returns a String type that specifies the ID of the new sales literature item.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiteratureItem proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem salesliteratureitem = new Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem();
salesliteratureitem.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliteratureitem.Url = strDir + "CRMSalesLiteratureItem.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureId = "{706D1D72-CF08-40CD-8059-CC0DF6377A19}";

   // Set up the XML string for the sales literature item
   string strSalesLiteratureItemXml = "<salesliteratureitem>";
   strSalesLiteratureItemXml += "<salesliteratureid>" + strSalesLiteratureId + "</salesliteratureid>";
   strSalesLiteratureItemXml += "<title>salesforce</title>";
   strSalesLiteratureItemXml += "<authorname>Michael Blythe</authorname>";
   strSalesLiteratureItemXml += "<keywords>keys1234</keywords>";
   strSalesLiteratureItemXml += "</salesliteratureitem>";

   string strSalesLiteratureItemId = salesliteratureitem.Create(userAuth, strSalesLiteratureItemXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMSalesLiteratureItem Class
  • Update


CRMSalesLiteratureItem.CreateAndRetrieve Method

The CreateAndRetrieve method creates a sales literature item and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityXml As String,
  ByVal ColumnSet As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  EntityXml,
  string  ColumnSet
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  EntityXml,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateSalesLiterature and prvReadSalesLiterature privileges to perform this action. See CUserAuth.
EntityXml
Specifies an XML string describing the new sales literature item. The XML schema is described by salesliteratureitem.xsd.
ColumnSet
Specifies an XML string describing the set of columns that are to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesliteratureitem.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the new sales literature item. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by salesliteratureitem.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiteratureItem proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem salesliteratureitem = new Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem();
salesliteratureitem.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliteratureitem.Url = strDir + "CRMSalesLiteratureItem.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureId = "{706D1D72-CF08-40CD-8059-CC0DF6377A19}";

   // Set up the XML string for the sales literature item
   string strSalesLiteratureItemXml = "<salesliteratureitem>";
   strSalesLiteratureItemXml += "<salesliteratureid>" + strSalesLiteratureId + "</salesliteratureid>";
   strSalesLiteratureItemXml += "<title>salesforce</title>";
   strSalesLiteratureItemXml += "<authorname>Michael Blythe</authorname>";
   strSalesLiteratureItemXml += "<keywords>keys1234</keywords>";
   strSalesLiteratureItemXml += "</salesliteratureitem>";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   string strResultsXml = salesliteratureitem.CreateAndRetrieve(userAuth, strSalesLiteratureItemXml, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMSalesLiteratureItem Class
  • UpdateAndRetrieve


CRMSalesLiteratureItem.Delete Method

The Delete method deletes a sales literature item.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  EntityId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  EntityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteSalesLiterature privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the sales literature item that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiteratureItem proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem salesliteratureitem = new Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem();
salesliteratureitem.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliteratureitem.Url = strDir + "CRMSalesLiteratureItem.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureItemId = "{CD079251-CD0E-4154-B0D6-8062D2C98C1D}";

   // Delete the sales literature item
   salesliteratureitem.Delete(userAuth, strSalesLiteratureItemId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesLiteratureItem Class


CRMSalesLiteratureItem.RemoveBinaryData Method

The RemoveBinaryData method removes an attachment from a sales literature item.

Syntax

[Visual Basic .NET]
Public Sub RemoveBinaryData(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String
)
[C#]
public void RemoveBinaryData(
  CUserAuth  Caller,
  string  EntityId
);
[C++]
public: void RemoveBinaryData(
  CUserAuth*  Caller,
  String*  EntityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteSalesLiterature privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the sales literature item.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiteratureItem proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem salesliteratureitem = new Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem();
salesliteratureitem.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliteratureitem.Url = strDir + "CRMSalesLiteratureItem.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureItemId = "{CD079251-CD0E-4154-B0D6-8062D2C98C1D}";

   // Remove the attachment from the item
   salesliteratureitem.RemoveBinaryData(userAuth, strSalesLiteratureItemId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesLiteratureItem Class


CRMSalesLiteratureItem.Retrieve Method

The Retrieve method retrieves a sales literature item by ID.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  EntityId,
  string  ColumnSet
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadSalesLiterature privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the sales literature item.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesliteratureitem.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the sales literature item. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by salesliteratureitem.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiteratureItem proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem salesliteratureitem = new Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem();
salesliteratureitem.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliteratureitem.Url = strDir + "CRMSalesLiteratureItem.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureItemId = "{CD079251-CD0E-4154-B0D6-8062D2C98C1D}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Remove the attachment from the item
   string strResultsXml = salesliteratureitem.Retrieve(userAuth, strSalesLiteratureItemId, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesLiteratureItem Class
  • RetrieveByObject


CRMSalesLiteratureItem.RetrieveByObject Method

The RetrieveByObject method retrieves all sales literature items that are associated with an object (sales literature).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Entity As CObjectName,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Entity,
  string  ColumnSet
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Entity,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadSalesLiterature privilege to perform this action. See CUserAuth.
Entity
Specifies the object (sales literature). See CObjectName.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesliteratureitem.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the set of sales literature items associated with the specified object. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<salesliteratureitems> + salesliteratureitem1..N + </salesliteratureitems>

where the XML schema for each sales literature item is described by salesliteratureitem.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiteratureItem proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem salesliteratureitem = new Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem();
salesliteratureitem.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliteratureitem.Url = strDir + "CRMSalesLiteratureItem.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureId = "{706D1D72-CF08-40CD-8059-CC0DF6377A19}";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strSalesLiteratureId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otSalesLiterature;

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve all of the items for a sales literature object
   string strResultsXml = salesliteratureitem.RetrieveByObject(userAuth, objName, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesLiteratureItem Class
  • Retrieve


CRMSalesLiteratureItem.Update Method

The Update method updates a sales literature item.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal EntityXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  EntityId,
  string  EntityXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  EntityXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteSalesLiterature privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the sales literature item.
EntityXml
Specifies an XML string describing the sales literature item. The XML schema is described by salesliteratureitem.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiteratureItem proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem salesliteratureitem = new Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem();
salesliteratureitem.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliteratureitem.Url = strDir + "CRMSalesLiteratureItem.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureItemId = "{CD079251-CD0E-4154-B0D6-8062D2C98C1D}";

   // Set up the XML string for the sales literature item
   string strSalesLiteratureItemXml = "<salesliteratureitem>";
   strSalesLiteratureItemXml += "<title>salesforce1</title>";
   strSalesLiteratureItemXml += "<authorname>Michael Blythe</authorname>";
   strSalesLiteratureItemXml += "<keywords>keys123455</keywords>";
   strSalesLiteratureItemXml += "</salesliteratureitem>";

   // Now update the item
   salesliteratureitem.Update (userAuth, strSalesLiteratureItemId, strSalesLiteratureItemXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMSalesLiteratureItem Class
  • UpdateAndRetrieve


CRMSalesLiteratureItem.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a sales literature item and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal EntityXml As String,
  ByVal ColumnSet As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  EntityId,
  string  EntityXml,
  string  ColumnSet
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  EntityXml,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteSalesLiterature and prvReadSalesLiterature privileges to perform this action. See CUserAuth.
EntityId
Specifies the ID of the sales literature item.
EntityXml
Specifies an XML string describing the sales literature item. The XML schema is described by salesliteratureitem.xsd.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesliteratureitem.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data representing the sales literature item. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by salesliteratureitem.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesLiteratureItem proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem salesliteratureitem = new Microsoft.Crm.Platform.Proxy.CRMSalesLiteratureItem();
salesliteratureitem.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesliteratureitem.Url = strDir + "CRMSalesLiteratureItem.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSalesLiteratureId = "{706D1D72-CF08-40CD-8059-CC0DF6377A19}";
   string strSalesLiteratureItemId = "{CD079251-CD0E-4154-B0D6-8062D2C98C1D}";

   // Set up the XML string for the sales literature item
   string strSalesLiteratureItemXml = "<salesliteratureitem>";
   strSalesLiteratureItemXml += "<salesliteratureid>" + strSalesLiteratureId + "</salesliteratureid>";
   strSalesLiteratureItemXml += "<title>salesforce1</title>";
   strSalesLiteratureItemXml += "<authorname>Michael Blythe</authorname>";
   strSalesLiteratureItemXml += "<keywords>keys123455</keywords>";
   strSalesLiteratureItemXml += "</salesliteratureitem>";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Now update and then retrieve the item
   string strResultsXml = salesliteratureitem.UpdateAndRetrieve(userAuth, strSalesLiteratureItemId, strSalesLiteratureItemXml, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMSalesLiteratureItem Class
  • Update


CRMSalesOrder Class

The CRMSalesOrder class contains methods that you can use to manage sales orders.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMSalesOrder
[Visual Basic .NET]
Public Class CRMSalesOrder
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMSalesOrder : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMSalesOrder: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMSalesOrder class exposes the following methods.

Method | Description
Assign | Assigns a sales order.
AssociateContact | Establishes an association between a contact and a sales order.
Cancel | Sets the state of a sales order to Canceled.
ConvertToInvoice | Converts a sales order to an invoice.
Create | Creates a sales order.
CreateAndRetrieve | Creates a sales order and then retrieves it.
Delete | Deletes a sales order.
DisassociateContact | Eliminates the association between a contact and a sales order.
GenerateFromOpportunity | Generates a sales order from an opportunity.
GetProductsFromOpportunity | Retrieves the products from an opportunity and copies them to the sales order.
GrantAccess | Grants access to a sales order.
ModifyAccess | Replaces the access rights on the sales order for the specified security principal.
Retrieve | Retrieves a sales order.
RetrieveByObject | Retrieves all sales orders that are associated with an object (account, contact, or opportunity).
RetrieveByPrincipal | Retrieves all sales orders that are owned by a security principal.
RetrieveContacts | Retrieves all contacts that are associated with a sales order.
RetrievePrincipalAccess | Retrieves the access a security principal has for the specified sales order.
RetrieveSharedPrincipalsAndAccess | Retrieves all of the security principals that have access to a sales order and their access rights for the sales order.
RevokeAccess | Revokes access to a sales order.
Submit | Sets the state of a sales order to Submitted.
SubmitOrConvert | Submits a sales order or converts a sales order to an invoice.
Update | Updates a sales order.
UpdateAndRetrieve | Updates a sales order and retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMSalesOrder.Assign Method

The Assign method assigns the sales order to a security principal (user or team). (See Remarks.) This method also applies to the parent object and associated objects that have the same owner as the parent object. Therefore when you assign the parent object to a new owner, only the associated objects that have the same owner as the parent object are assigned. In addition, when an object is assigned to a new owner, it is shared with the previous owner with full rights. Either the new owner or the previous owner can remove the relationship or lower the level of privileges the previous owner had on the object.

Syntax

[Visual Basic .NET]
Public Sub Assign(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal Assignee As CSecurityPrincipal
)
[C#]
public void Assign(
  CUserAuth  Caller,
  string  SalesOrderId,
  CSecurityPrincipal  Assignee
);
[C++]
public: void Assign(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  CSecurityPrincipal*  Assignee
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignOrder privilege to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order.
Assignee
Specifies the new owner of the sales order. The new owner can be a user or a team. See CSecurityPrincipal.

Return Value

No return value.

Remarks

Note The Microsoft CRM application does not support business-object assignment to teams. Therefore, any solutions built by using this method are not supported by the Microsoft CRM application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";
string strUserId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = strUserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Assign the sales order to a security principal
   salesorder.Assign (userAuth, strSalesOrderId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.AssociateContact Method

The AssociateContact method establishes an association between a contact and a sales order.

Syntax

[Visual Basic .NET]
Public Sub AssociateContact(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal ContactId As String
)
[C#]
public void AssociateContact(
  CUserAuth  Caller,
  string  SalesOrderId,
  string  ContactId
);
[C++]
public: void AssociateContact(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  String*  ContactId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendToOrder and prvAppendContact privileges to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order.
ContactId
Specifies the ID of the contact.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";
string strContactId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Associate the sales order with a contact
   salesorder.AssociateContact (userAuth, strSalesOrderId, strContactId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.Cancel Method

The Cancel method sets the state of a sales order to Canceled.

Syntax

[Visual Basic .NET]
Public Sub Cancel(
  ByVal Caller As CUserAuth,
  ByVal ActivityXml As String,
  ByVal PartiesXml As String,
  ByVal Status As Integer
)
[C#]
public void Cancel(
  CUserAuth  Caller,
  string  ActivityXml,
  string  PartiesXml,
  int  Status
);
[C++]
public: void Cancel(
  CUserAuth*  Caller,
  String*  ActivityXml,
  String*  PartiesXml,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteOrder privilege to perform this action. See CUserAuth.
ActivityXml
Specifies an XML string containing the sales order information. The XML schema is described by salesorder.xsd.
PartiesXml
Specifies an XML string containing the party information. The XML schema is described by activityparty.xsd.
Status
Specifies the status of the sales order. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for an activity
   string strActivity = "<activity>" +
      "<objectid>" + strSalesOrderId + "</objectid>" +
      "<objecttypecode>" + (int)Microsoft.Crm.Platform.Types.ObjectType.otSalesOrder.ToString() + "</objecttypecode>" +
      "<owninguser>" + userAuth.UserId + "</owninguser>" +
      "<activitytypecode>" + (int)Microsoft.Crm.Platform.Types.ObjectType.otOrderCloseActivity.ToString() + "</activitytypecode>" +
      "</activity>";

   // Cancel the sales order
   salesorder.Cancel  (userAuth, strActivity, "", -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.ConvertToInvoice Method

The ConvertToInvoice method converts a sales order to an invoice.

Syntax

[Visual Basic .NET]
Public Function ConvertToInvoice(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string ConvertToInvoice(
  CUserAuth  Caller,
  string  SalesOrderId,
  string  ColumnSetXml
);
[C++]
public: String* ConvertToInvoice(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadInvoice and prvCreateInvoice privileges to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order that is to be converted.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in invoice.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the invoice information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by invoice.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Convert the sales order to an invoice
   string strResultXml = salesorder.ConvertToInvoice (userAuth, strSalesOrderId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.Create Method

The Create method creates a sales order.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  SalesOrderXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  SalesOrderXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateOrder privilege to perform this action. See CUserAuth.
SalesOrderXml
Specifies an XML string containing the sales order information. The XML schema is described by salesorder.xsd.

Return Value

Returns a String type that specifies the ID of the newly created sales order.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strCustomerId = "{CBDED4DD-CF90-43ED-85A9-0B33D205F9A6}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the sales order
   string xml = " <salesorder>";
   xml += "<name>Test Sales Order </name>";
   xml += "<customerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() +"\">";
   xml += strCustomerId + "</customerid>";
   xml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   xml += userAuth.UserId + "</ownerid>";
   xml += "</salesorder>";

   // Create the sales order
   string strSalesOrderId = salesorder.Create (userAuth, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMSalesOrder Class
  • Update


CRMSalesOrder.CreateAndRetrieve Method

The CreateAndRetrieve method creates a sales order and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InSalesOrderXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InSalesOrderXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InSalesOrderXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateOrder and prvReadOrder privileges to perform this action. See CUserAuth.
InSalesOrderXml
Specifies an XML string containing the sales order information. The XML schema is described by salesorder.xsd.

Return Value

Returns a String type that specifies the XML data containing the newly created sales order information. The XML schema is described by salesorder.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strCustomerId = "{CBDED4DD-CF90-43ED-85A9-0B33D205F9A6}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the sales order
   string xml = " <salesorder>";
   xml += "<name>Test Sales Order </name>";
   xml += "<customerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otAccount.ToString() +"\">";
   xml += strCustomerId + "</customerid>";
   xml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
   xml += userAuth.UserId + "</ownerid>";
   xml += "</salesorder>";

   // Create the sales order, and then retrieve it
   string strSalesOrderXml = salesorder.CreateAndRetrieve (userAuth, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMSalesOrder Class
  • UpdateAndRetrieve


CRMSalesOrder.Delete Method

The Delete method deletes a sales order.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  SalesOrderId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  SalesOrderId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteOrder privilege to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the sales order
   salesorder.Delete (userAuth, strSalesOrderId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.DisassociateContact Method

The DisassociateContact method eliminates the association between a contact and a sales order.

Syntax

[Visual Basic .NET]
Public Sub DisassociateContact(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal ContactId As String
)
[C#]
public void DisassociateContact(
  CUserAuth  Caller,
  string  SalesOrderId,
  string  ContactId
);
[C++]
public: void DisassociateContact(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  String*  ContactId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAppendToOrder and prvAppendContact privileges to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order.
ContactId
Specifies the ID of the contact that is to be disassociated from the sales order.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";
string strContactId = "{93639AD8-CA01-4B16-B09C-EFEE53FA8799}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Disassociate the sales order from the contact
   salesorder.DisassociateContact (userAuth, strSalesOrderId, strContactId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.GenerateFromOpportunity Method

The GenerateFromOpportunity method generates a sales order from an opportunity.

Syntax

[Visual Basic .NET]
Public Function GenerateFromOpportunity(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string GenerateFromOpportunity(
  CUserAuth  Caller,
  string  OpportunityId,
  string  ColumnSetXml
);
[C++]
public: String* GenerateFromOpportunity(
  CUserAuth*  Caller,
  String*  OpportunityId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvCreateOrder and prvReadOpportunity privileges to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity that is to be used as a basis for the sales order.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesorder.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the new sales order information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by salesorder.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strOpportunityId = "{C32FF898-53DB-4C8E-9D21-F534891BC816}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Generate a sales order from an opportunity
   string strResultsXml = salesorder.GenerateFromOpportunity (userAuth, strOpportunityId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.GetProductsFromOpportunity Method

The GetProductsFromOpportunity method retrieves the products from an opportunity and copies them to the sales order.

Syntax

[Visual Basic .NET]
Public Sub GetProductsFromOpportunity(
  ByVal Caller As CUserAuth,
  ByVal OpportunityId As String,
  ByVal SalesOrderId As String
)
[C#]
public void GetProductsFromOpportunity(
  CUserAuth  Caller,
  string  OpportunityId,
  string  SalesOrderId
);
[C++]
public: void GetProductsFromOpportunity(
  CUserAuth*  Caller,
  String*  OpportunityId,
  String*  SalesOrderId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct and prvReadOpportunity privileges to perform this action. See CUserAuth.
OpportunityId
Specifies the ID of the opportunity.
SalesOrderId
Specifies the ID of the sales order.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder     salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strOpportunityId = "{C32FF898-53DB-4C8E-9D21-F534891BC816}";
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Get the products from the opportunity
   string strResults = salesorder.GetProductsFromOpportunity (userAuth, strOpportunityId, strSalesOrderId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.GrantAccess Method

The GrantAccess method grants a security principal access to the specified sales order. This method also applies to all child objects of the sales order. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the sales order. In this case, only the lack of privileges for a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub GrantAccess(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal Rights As UInt32,
  ByVal Principal As CSecurityPrincipal
)
[C#]
public void GrantAccess(
  CUserAuth  Caller,
  string  SalesOrderId,
  uint  Rights,
  CSecurityPrincipal  Principal
);
[C++]
public: void GrantAccess(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  unsigned long  Rights,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareOrder privilege to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order that is to be shared.
Rights
Specifies the rights that are to be granted. See ACCESSRIGHTS.
Principal
Specifies the security principal (user or team) with whom the sales order is to be shared. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set up the rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_WRITE;

   // Grant access to the sales order
   salesorder.GrantAccess  (userAuth, strSalesOrderId, rights, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.ModifyAccess Method

The ModifyAccess method replaces the access rights on the sales order for the specified security principal. This method also applies to all child objects of the sales order. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, the child objects are not shared. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the sales order. In this case, only the lack of privileges to a particular object type prevents the child objects from being shared.

Syntax

[Visual Basic .NET]
Public Sub ModifyAccess(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal Rights As UInt32,
  ByVal Principal As CSecurityPrincipal
)
[C#]
public void ModifyAccess(
  CUserAuth  Caller,
  string  SalesOrderId,
  uint  Rights,
  CSecurityPrincipal  Principal
);
[C++]
public: void ModifyAccess(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  unsigned long  Rights,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareOrder privilege to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order that is to be shared.
Rights
Specifies the rights that are to be granted. See ACCESSRIGHTS.
Principal
Specifies the security principal (user or team) with whom the sales order is to be shared. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder     salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Set up the rights
   uint rights = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_ALL;

   // Modify access to the sales order
   salesorder.ModifyAccess  (userAuth, strSalesOrderId, rights, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.Retrieve Method

The Retrieve method retrieves a sales order.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  SalesOrderId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrder privilege to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order that is to be retrieved.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesorder.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the sales order information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by salesorder.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the sales order
   string strResultXml = salesorder.Retrieve (userAuth, strSalesOrderId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class
  • RetrieveByObject
  • RetrieveByPrincipal
  • RetrieveContacts
  • RetrieveSharedPrincipalsAndAccess


CRMSalesOrder.RetrieveByObject Method

The RetrieveByObject method retrieves all sales orders that are associated with an object (account, contact, or opportunity).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal StateCodes As Integer(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  int[]  StateCodes,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  long  StateCodes __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrder privilege to perform this action. See CUserAuth.
Object
Specifies the object (account, contact, or opportunity) for which associated sales orders are to be retrieved. See CObjectName.
StateCodes
Specifies an array of state codes. Retrieves only sales orders that are in these states. See SALES_ORDER_STATE.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesorder.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of sales orders associated with the specified object. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<salesorders> + salesorder1..N + </salesorders>

where the XML schema for each sales order is described by salesorder.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strAccountId = "{CBDED4DD-CF90-43ED-85A9-0B33D205F9A6}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Initialize the account object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strAccountId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otAccount;

   // An array of state codes to find
   int[] arrCodes = new int[] {Microsoft.Crm.Platform.Types.INVOICE_STATE.INS_ACTIVE,Microsoft.Crm.Platform.Types.SALES_ORDER_STATE.SOS_ACTIVE};

   // Retrieve the sales order by account object
   string strResultXml = salesorder.RetrieveByObject (userAuth, objName, arrCodes, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class
  • Retrieve


CRMSalesOrder.RetrieveByPrincipal Method

The RetrieveByPrincipal method retrieves all sales orders that are owned by a security principal.

Syntax

[Visual Basic .NET]
Public Function RetrieveByPrincipal(
  ByVal Caller As CUserAuth,
  ByVal Principal As CSecurityPrincipal,
  ByVal StateCodes As Integer(),
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByPrincipal(
  CUserAuth  Caller,
  CSecurityPrincipal  Principal,
  int[]  StateCodes,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByPrincipal(
  CUserAuth*  Caller,
  CSecurityPrincipal*  Principal,
  long  StateCodes __gc[],
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrder privilege to perform this action. See CUserAuth.
Principal
Specifies the security principal for whom sales orders are to be retrieved. See CSecurityPrincipal.
StateCodes
Specifies an array of state codes. Retrieves only sales orders that are in these states. See SALES_ORDER_STATE.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesorder.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of sales orders requested. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<salesorders> + salesorder1..N + </salesorders>

where the XML schema for each sales order is described by salesorder.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // An array of state codes to find
   int[] arrCodes = new int[] {Microsoft.Crm.Platform.Types.INVOICE_STATE.INS_ACTIVE,Microsoft.Crm.Platform.Types.SALES_ORDER_STATE.SOS_ACTIVE};

   // Retrieve the sales order by security principal
   string strResultXml = salesorder.RetrieveByPrincipal (userAuth, securityPrincipal, arrCodes, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class
  • Retrieve


CRMSalesOrder.RetrieveContacts Method

The RetrieveContacts method retrieves all contacts that are associated with a sales order.

Syntax

[Visual Basic .NET]
Public Function RetrieveContacts(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveContacts(
  CUserAuth  Caller,
  string  SalesOrderId,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveContacts(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrder and prvReadContact privileges to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order for which contacts are to be retrieved.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesorder.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of contacts requested. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<contacts> + contact1..N + </contacts>

where the XML schema for each contact is described by contact.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the contacts that are associated with the sales order
   string strResultXml = salesorder.RetrieveContacts (userAuth, strSalesOrderId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class
  • Retrieve


CRMSalesOrder.RetrievePrincipalAccess Method

The RetrievePrincipalccess method retrieves the access a security principal has to the specified sales order.

Syntax

[Visual Basic .NET]
Public Function RetrievePrincipalAccess(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal Principal As CSecurityPrincipal
) As UInt32
[C#]
public uint RetrievePrincipalAccess(
  CUserAuth  Caller,
  string  SalesOrderId,
  CSecurityPrincipal  Principal
);
[C++]
public: unsigned long RetrievePrincipalAccess(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrder privilege to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order for which access is to be retrieved.
Principal
Specifies the security principal (user or team) for whom access is to be retrieved. See CSecurityPrincipal.

Return Value

Returns a UInt32 type that specifies the rights the security principal has for the sales order.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Retrieve the access
   uint access = salesorder.RetrievePrincipalAccess (userAuth, strSalesOrderId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class
  • Retrieve


CRMSalesOrder.RetrieveSharedPrincipalsAndAccess Method

The RetrieveSharedPrincipalsAndAccess method retrieves all of the security principals (users or teams) that have access to a sales order and their access rights to that sales order.

Syntax

[Visual Basic .NET]
Public Function RetrieveSharedPrincipalsAndAccess(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByRef Rights As UInt32()
) As CSecurityPrincipal()
[C#]
public CSecurityPrincipal[] RetrieveSharedPrincipalsAndAccess(
  CUserAuth  Caller,
  string  SalesOrderId,
  out uint[]  Rights
);
[C++]
public: CSecurityPrincipal* RetrieveSharedPrincipalsAndAccess(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  unsigned long*  Rights
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrder privilege to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order to find.
Rights
[out] Specifies an array of rights for the principals. See ACCESSRIGHTS.

Return Value

Returns a CSecurityPrincipal[] type specifies the array of principals requested. See CSecurityPrincipal.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
uint[] rights;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Initialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal[] securityPrincipals;

   // Retrieve the shared principal access
   securityPrincipals = salesorder.RetrieveSharedPrincipalsAndAccess (userAuth, strSalesOrderId, out rights);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class
  • Retrieve


CRMSalesOrder.RevokeAccess Method

The RevokeAccess method revokes access rights to the sales order for the specified security principal. This method also applies to all child objects of the sales order. For all child objects, if the caller does not have share privileges for those object types or share rights to the objects, access to the child objects is not revoked. As a result, the owner of the object or a user who shares the object with share rights automatically has share rights to all child objects of the sales order. In this case, only the lack of privileges to a particular object type prevents access to the child objects from being revoked.

Syntax

[Visual Basic .NET]
Public Sub RevokeAccess(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal Principal As CSecurityPrincipal
)
[C#]
public void RevokeAccess(
  CUserAuth  Caller,
  string  SalesOrderId,
  CSecurityPrincipal  Principal
);
[C++]
public: void RevokeAccess(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  CSecurityPrincipal*  Principal
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvShareOrder privilege to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order for which access is to be revoked.
Principal
Specifies the security principal (user or team) for which access is to be revoked. See CSecurityPrincipal.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Intialize the security principal
   Microsoft.Crm.Platform.Proxy.CSecurityPrincipal securityPrincipal = new Microsoft.Crm.Platform.Proxy.CSecurityPrincipal();
   securityPrincipal.Id = userAuth.UserId;
   securityPrincipal.Type = Microsoft.Crm.Platform.Proxy.SecurityPrincipalType.sptUser;

   // Revoke access to the sales order
   salesorder.RevokeAccess (userAuth, strSalesOrderId, securityPrincipal);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.Submit Method

The Submit method sets the state of a sales order to Submitted.

Syntax

[Visual Basic .NET]
Public Sub Submit(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal Status As Integer
)
[C#]
public void Submit(
  CUserAuth  Caller,
  string  SalesOrderId,
  int  Status
);
[C++]
public: void Submit(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  long  Status
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteOrder privilege to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order that is to be submitted.
Status
Specifies the status of the sales order. You can use this parameter to specify application status. See Remarks.

Return Value

No return value.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder     salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Submit the sales order
   salesorder.Submit (userAuth, strSalesOrderId, -1);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.SubmitOrConvert Method

The SubmitorConvert method submits a sales order or converts a sales order to an invoice. If Microsoft Business Solutions CRM Integration for Great Plains is installed and enabled, the Submit method is called. Otherwise, the ConvertToInvoice method is called.

Syntax

[Visual Basic .NET]
Public Function SubmitOrConvert(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal Status As Integer,
  ByVal ColumnSetXml As String
) As String
[C#]
public string SubmitOrConvert(
  CUserAuth  Caller,
  string  SalesOrderId,
  int  Status,
  string  ColumnSetXml
);
[C++]
public: String* SubmitOrConvert(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  long  Status,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. For submit, the caller must have the prvWriteOrder privilege to perform this action. For convert to invoice, the caller must have the prvReadOrder, prvReadInvoice and prvCreateInvoice privileges to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order that is to be submitted.
Status
Specifies the status of the sales order. You can use this parameter to specify application status. See Remarks.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in invoice.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the invoice information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by invoice.xsd.

Remarks

Note The Status parameter corresponds to Status Reason in the Microsoft CRM application. If you pass -1 for this parameter, the platform sets the status to the appropriate value for the Microsoft CRM application. You can use the RetrieveStatus method to retrieve the status codes used in the application.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{37F05EC6-0A39-400E-84D1-CCD9F72F034F}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>accountid</column>";
   strColumnSetXml += "</columnset>";

   // Submit the sales order
   string strResultXml = salesorder.SubmitOrConvert (userAuth, strSalesOrderId, -1, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrder Class


CRMSalesOrder.Update Method

The Update method updates a sales order.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal SalesOrderXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  SalesOrderId,
  string  SalesOrderXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  String*  SalesOrderXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteOrder privilege to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order that is to be updated.
SalesOrderXml
Specifies an XML string containing the new sales order information. The XML schema is described by salesorder.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{B329D5A4-4EDF-41C5-A06A-6BA123B73D5D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the sales order
   string xml = " <salesorder>";
   xml += "<name>Test Sales Order updated</name>";
   xml += "</salesorder>";

   // Update the sales order
   salesorder.Update (userAuth, strSalesOrderId, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMSalesOrder Class
  • UpdateAndRetrieve


CRMSalesOrder.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a sales order and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal InSalesOrderXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  SalesOrderId,
  string  InSalesOrderXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  String*  InSalesOrderXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteOrder and prvReadOrder privileges to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order that is to be updated.
InSalesOrderXml
Specifies an XML string containing the new sales order information. The XML schema is described by salesorder.xsd.

Return Value

Returns a String type that specifies the XML data containing the updated sales order information. The XML schema is described by salesorder.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrder proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrder salesorder = new Microsoft.Crm.Platform.Proxy.CRMSalesOrder ();
salesorder.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorder.Url = strDir + "CRMSalesOrder.srf";

string strErrorMsg;
string strSalesOrderId = "{B329D5A4-4EDF-41C5-A06A-6BA123B73D5D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the sales order
   string xml = " <salesorder>";
   xml += "<name>Test Sales Order updated </name>";
   xml += "</salesorder>";

   // Update the sales order, and then retrieve it
   string strResultXml = salesorder.UpdateAndRetrieve (userAuth, strSalesOrderId, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMSalesOrder Class
  • Update


CRMSalesOrderDetail Class

The CRMSalesOrderDetail class contains methods that you can use to manage sales order details.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMSalesOrderDetail
[Visual Basic .NET]
Public Class CRMSalesOrderDetail
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMSalesOrderDetail : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMSalesOrderDetail: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMSalesOrderDetail class exposes the following methods.

Method | Description
Create | Creates a sales order detail.
CreateAndRetrieve | Creates a sales order detail and then retrieves it.
Delete | Deletes a sales order detail.
GetQuantityDecimal | Retrieves the quantity decimal value for the specified sales order, product and unit of measure.
Retrieve | Retrieves a sales order detail.
RetrieveByObject | Retrieves all sales order details that are associated with the specified object (sales order).
Update | Updates a sales order detail.
UpdateAndRetrieve | Updates a sales order detail and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMSalesOrderDetail.Create Method

The Create method creates a sales order detail.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderDetailXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  SalesOrderDetailXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  SalesOrderDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateOrder and prvAppendToOrder privileges to perform this action. See CUserAuth.
SalesOrderDetailXml
Specifies an XML string containing the new sales order detail information. The XML schema is described by salesorderdetail.xsd.

Return Value

Returns a String type that specifies the ID of the newly created sales order detail.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrderDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail salesorderdetail = new Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail();
salesorderdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorderdetail.Url = strDir + "CRMSalesOrderDetail.srf";

string strErrorMsg;
string strSalesOrderId = "{B329D5A4-4EDF-41C5-A06A-6BA123B73D5D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the sales order detail
   string xml = "<salesorderdetail>";
   xml += "<description>Test Sales Order Detail</description>";
   xml += "<salesorderid>" + strSalesOrderId + "</salesorderid>";
   xml += "</salesorderdetail>";

   // Create the sales order detail
   string strSalesOrderDetailId = salesorderdetail.Create (userAuth, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMSalesOrderDetail Class
  • Update


CRMSalesOrderDetail.CreateAndRetrieve Method

The CreateAndRetrieve method creates a sales order detail and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InSalesOrderDetailXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InSalesOrderDetailXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InSalesOrderDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvCreateOrder, prvAppendToOrder, and prvReadOrder privileges to perform this action. See CUserAuth.
InSalesOrderDetailXml
Specifies an XML string containing the new sales order detail information. The XML schema is described by salesorderdetail.xsd.

Return Value

Returns a String type that specifies the XML data containing the sales order detail. The XML schema is described by salesorderdetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrderDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail salesorderdetail = new Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail();
salesorderdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorderdetail.Url = strDir + "CRMSalesOrderDetail.srf";

string strErrorMsg;
string strSalesOrderId = "{B329D5A4-4EDF-41C5-A06A-6BA123B73D5D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the sales order detail
   string xml = "<salesorderdetail>";
   xml += "<description>Test Sales Order Detail</description>";
   xml += "<salesorderid>" + strSalesOrderId + "</salesorderid>";
   xml += "</salesorderdetail>";

   // Create the sales order detail, and then retrieve it
   string strResultsXml = salesorderdetail.CreateAndRetrieve(userAuth, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMSalesOrderDetail Class
  • UpdateAndRetrieve


CRMSalesOrderDetail.Delete Method

The Delete method deletes a sales order detail.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderDetailId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  SalesOrderDetailId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  SalesOrderDetailId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteOrder privilege to perform this action. See CUserAuth.
SalesOrderDetailId
Specifies the ID of the sales order detail that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrderDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail salesorderdetail = new Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail();
salesorderdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorderdetail.Url = strDir + "CRMSalesOrderDetail.srf";

string strErrorMsg;
string strSalesOrderDetailId = "{216FB749-BF3A-4105-BF8D-603DB8726496}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the sales order detail
   salesorderdetail.Delete (userAuth, strSalesOrderDetailId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrderDetail Class


CRMSalesOrderDetail.GetQuantityDecimal Method

The GetQuantityDecimal method retrieves the quantity decimal value for the specified sales order, product and unit of measure.

Syntax

[Visual Basic .NET]
Public Function GetQuantityDecimal(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderId As String,
  ByVal ProductId As String,
  ByVal UoMId As String
) As Integer
[C#]
public int GetQuantityDecimal(
  CUserAuth  Caller,
  string  SalesOrderId,
  string  ProductId,
  string  UoMId
);
[C++]
public: long GetQuantityDecimal(
  CUserAuth*  Caller,
  String*  SalesOrderId,
  String*  ProductId,
  String*  UoMId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrder privilege to perform this action. See CUserAuth.
SalesOrderId
Specifies the ID of the sales order.
ProductId
Specifies the ID of the product.
UoMId
Specifies the ID of the unit of measure.

Return Value

Returns an Int32 type that specifies the quantity decimal information for the specified sales order, product, and unit of measure.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrderDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail salesorderdetail = new Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail();
salesorderdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorderdetail.Url = strDir + "CRMSalesOrderDetail.srf";

string strErrorMsg;
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";
string strUoMId = "{E0B38CBE-91BB-4863-8F4F-76785CE705D2}";
string strSalesOrderId = "{B329D5A4-4EDF-41C5-A06A-6BA123B73D5D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Get the quantity decimal value
   int quantity = salesorderdetail.GetQuantityDecimal (userAuth, strSalesOrderId, strProductId, strUoMId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrderDetail Class


CRMSalesOrderDetail.Retrieve Method

The Retrieve method retrieves a sales order detail.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderDetailId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  SalesOrderDetailId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  SalesOrderDetailId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrder privilege to perform this action. See CUserAuth.
SalesOrderDetailId
Specifies the ID of the sales order detail that is to be retrieved.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesorderdetail.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the sales order detail information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by salesorderdetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrderDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail salesorderdetail = new Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail();
salesorderdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorderdetail.Url = strDir + "CRMSalesOrderDetail.srf";

string strErrorMsg;
string strSalesOrderDetailId = "{216FB749-BF3A-4105-BF8D-603DB8726496}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the sales order detail
   string strResultsXml = salesorderdetail.Retrieve (userAuth, strSalesOrderDetailId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrderDetail Class
  • RetrieveByObject


CRMSalesOrderDetail.RetrieveByObject Method

The RetrieveByObject method retrieves all sales order details that are associated with the specified object (sales order).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadOrder privilege to perform this action. See CUserAuth.
Object
Specifies the object (sales order) for which associated sales order details are to be retrieved. See CObjectName.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in salesorderdetail.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of sales order details for the specified object. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<salesorderdetails> + salesorderdetail1..N + </salesorderdetails>

where the XML schema for each sales order detail is described by salesorderdetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrderDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail     salesorderdetail = new Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail();
salesorderdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorderdetail.Url = strDir + "CRMSalesOrderDetail.srf";

string strErrorMsg;
string strSalesOrderId = "{B329D5A4-4EDF-41C5-A06A-6BA123B73D5D}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Initialize the sales order object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strSalesOrderId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otSalesOrder;

   // Retrieve the sales order details by sales order object
   string strResultsXml = salesorderdetail.RetrieveByObject (userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesOrderDetail Class
  • Retrieve


CRMSalesOrderDetail.Update Method

The Update method updates a sales order detail.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderDetailId As String,
  ByVal SalesOrderDetailXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  SalesOrderDetailId,
  string  SalesOrderDetailXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  SalesOrderDetailId,
  String*  SalesOrderDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteOrder privilege to perform this action. See CUserAuth.
SalesOrderDetailId
Specifies the ID of the sales order detail that is to be updated.
SalesOrderDetailXml
Specifies an XML string containing the new sales order detail information. The XML schema is described by salesorderdetail.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrderDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail salesorderdetail = new Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail();
salesorderdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorderdetail.Url = strDir + "CRMSalesOrderDetail.srf";

string strErrorMsg;
string strSalesOrderDetailId = "{216FB749-BF3A-4105-BF8D-603DB8726496}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the sales order detail
   string xml = "<salesorderdetail>";
   xml += "<description>Test Sales Order Detail 1</description>";
   xml += "</salesorderdetail>";

   // Update the sales order detail
   salesorderdetail.Update(userAuth, strSalesOrderDetailId, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMSalesOrderDetail Class
  • UpdateAndRetrieve


CRMSalesOrderDetail.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a sales order detail and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal SalesOrderDetailId As String,
  ByVal InSalesOrderDetailXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  SalesOrderDetailId,
  string  InSalesOrderDetailXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  SalesOrderDetailId,
  String*  InSalesOrderDetailXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteOrder and prvReadOrder privileges to perform this action. See CUserAuth.
SalesOrderDetailId
Specifies the ID of the sales order detail that is to be updated.
InSalesOrderDetailXml
Specifies an XML string containing the new sales order detail information. The XML schema is described by salesorderdetail.xsd.

Return Value

Returns a String type that specifies the XML data containing the new sales order detail information. The XML schema is described by salesorderdetail.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesOrderDetail proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail     salesorderdetail = new Microsoft.Crm.Platform.Proxy.CRMSalesOrderDetail();
salesorderdetail.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesorderdetail.Url = strDir + "CRMSalesOrderDetail.srf";

string strErrorMsg;
string strSalesOrderDetailId = "{216FB749-BF3A-4105-BF8D-603DB8726496}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the sales order detail
   string xml = "<salesorderdetail>";
   xml += "<description>Test Sales Order Detail 1</description>";
   xml += "</salesorderdetail>";

   // Update the sales order detail, and then retrieve it
   string strResultsXml = salesorderdetail.UpdateAndRetrieve (userAuth, strSalesOrderDetailId, xml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMSalesOrderDetail Class
  • Update


CRMSalesPerson Class

The CRMSalesPerson class contains methods that you can use to retrieve salesperson information. Salesperson is derived from system user.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMSalesPerson
[Visual Basic .NET]
Public Class CRMSalesPerson
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMSalesPerson : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMSalesPerson: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMSalesPerson class exposes the following methods.

Method | Description
RetrieveByOrganization | Retrieves all salesperson objects that are assigned an organization.
RetrieveByTerritory | Retrieves all salesperson objects that are assigned to a territory.
RetrieveUnassigned | Not supported in this release.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMSalesPerson.RetrieveByOrganization Method

The RetrieveByOrganization method retrieves all salesperson objects that are assigned to an organization.

Syntax

[Visual Basic .NET]
Public Function RetrieveByOrganization(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal FiscalCalendarType As Integer,
  ByVal FiscalCalendarEffectiveOn As String,
  ByVal FiscalPeriod As Integer,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveByOrganization(
  CUserAuth  Caller,
  string  OrganizationId,
  int  FiscalCalendarType,
  string  FiscalCalendarEffectiveOn,
  int  FiscalPeriod,
  string  ColumnSet
);
[C++]
public: String* RetrieveByOrganization(
  CUserAuth*  Caller,
  String*  OrganizationId,
  long  FiscalCalendarType,
  String*  FiscalCalendarEffectiveOn,
  long  FiscalPeriod,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadUser privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
FiscalCalendarType
Specifies the fiscal calendar type. This is one of the following from the ObjectType: otAnnualFiscalCalendar, otFixedMonthlyFiscalCalendar, otMonthlyFiscalCalendar, otQuarterlyFiscalCalendar, or otSemiAnnualFiscalCalendar.
FiscalCalendarEffectiveOn
Specifies the date on which the fiscal calendar is effective (beginning of the fiscal year).
FiscalPeriod
Specifies the fiscal period number (1…13).
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in systemuser.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of salesperson objects requested. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<systemusers> + systemuser1..N + </systemusers>

where the XML schema for each salesperson is described by systemuser.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesPerson proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesPerson  salesperson = new Microsoft.Crm.Platform.Proxy.CRMSalesPerson();
salesperson.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesperson.Url = strDir + "CRMSalesPerson.srf";

string strErrorMsg;
string strOrganizationId = "{B2BB383D-C9F2-4235-98DE-4A59F7569432}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set the fiscal calendar type
   int ftype = Microsoft.Crm.Platform.Types.CALENDAR_TYPE_CODE.CTC_APPOINTMENT;

   // Set up the columns that you want to retrieve
   string strColumnSet = "<columnset>";
   strColumnSet += "<column>fullname</column>";
   strColumnSet += "<column>businessunitid</column>";
   strColumnSet += "</columnset>";

   // Retrieve the salesperson objects by organization
   string strResultsXml = salesperson.RetrieveByOrganization (userAuth, strOrganizationId, ftype, "20030101T00:00:00", 1, strColumnSet);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesPerson Class


CRMSalesPerson.RetrieveByTerritory Method

The RetrieveByTerritory method retrieves all salesperson objects that are assigned to a territory.

Syntax

[Visual Basic .NET]
Public Function RetrieveByTerritory(
  ByVal Caller As CUserAuth,
  ByVal TerritoryId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveByTerritory(
  CUserAuth  Caller,
  string  TerritoryId,
  string  ColumnSet
);
[C++]
public: String* RetrieveByTerritory(
  CUserAuth*  Caller,
  String*  TerritoryId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadUser privilege to perform this action. See CUserAuth.
TerritoryId
Specifies the ID of the territory. See Remarks.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in systemuser.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of salesperson objects requested. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<systemusers> + systemuser1..N + </systemusers>

where the XML schema for each salesperson is described by systemuser.xsd.

Remarks

You cannot pass a null string for the TerritoryId parameter.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSalesPerson proxy object
Microsoft.Crm.Platform.Proxy.CRMSalesPerson  salesperson = new Microsoft.Crm.Platform.Proxy.CRMSalesPerson();
salesperson.Credentials = System.Net.CredentialCache.DefaultCredentials;
salesperson.Url = strDir + "CRMSalesPerson.srf";

string strErrorMsg;
string strTerritoryId = "{465FB749-DF3A-4105-KJ8D-603DB8726496}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSet = "<columnset>";
   strColumnSet += "<column>fullname</column>";
   strColumnSet += "<column>businessunitid</column>";
   strColumnSet += "</columnset>";

   // Retrieve the salesperson objects by territory
   string resultXml = salesperson.RetrieveByTerritory  (userAuth, strTerritoryId, strColumnSet);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSalesPerson Class


CRMSubject Class

The CRMSubject class contains methods that you can use to manage subjects. A subject is a category used to organize objects such as articles and sales literature.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMSubject
[Visual Basic .NET]
Public Class CRMSubject
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMSubject : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMSubject: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMSubject class exposes the following methods.

Method | Description
Create | Creates a new subject.
CreateAndRetrieve | Creates a new subject and then retrieves it.
Delete | Deletes a subject and re-links all child subjects.
Retrieve | Retrieves an existing subject.
RetrieveByParent | Retrieves all child subjects for the specified parent subject.
RetrieveRootNodes | Retrieves all root nodes for the specified organization.
Update | Updates an existing subject.
UpdateAndRetrieve | Updates an existing subject and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMSubject.Create Method

The Create method creates a new subject.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal SubjectXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  SubjectXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  SubjectXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateSubject privilege to perform this action. See CUserAuth.
SubjectXML
Specifies an XML string containing the subject information. The XML schema is described by subject.xsd.

Return Value

Returns a String type that specifies the ID of the new subject.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSubject proxy object
Microsoft.Crm.Platform.Proxy.CRMSubject subject = new Microsoft.Crm.Platform.Proxy.CRMSubject();
subject.Credentials = System.Net.CredentialCache.DefaultCredentials;
subject.Url = strDir + "CRMSubject.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the subject
   string strSubjectXml = "<subject>";
   strSubjectXml += "<title>title 1</title>";
   strSubjectXml += "<description>description1</description>";
   strSubjectXml += "</subject>";

   string SubjectId = subject.Create(userAuth, strSubjectXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMSubject Class
  • Update


CRMSubject.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new subject and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal SubjectXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  SubjectXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  SubjectXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateSubject and prvReadSubject privileges to perform this action. See CUserAuth.
SubjectXML
Specifies an XML string containing the subject information. The XML schema is described by subject.xsd.

Return Value

Returns a String type that specifies the XML data containing the new subject. The XML schema is described by subject.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSubject proxy object
Microsoft.Crm.Platform.Proxy.CRMSubject subject = new Microsoft.Crm.Platform.Proxy.CRMSubject();
subject.Credentials = System.Net.CredentialCache.DefaultCredentials;
subject.Url = strDir + "CRMSubject.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the subject
   string strSubjectXml = "<subject>";
   strSubjectXml += "<title>title 1</title>";
   strSubjectXml += "<description>description1</description>";
   strSubjectXml += "</subject>";

   // Create and then retrieve the subject
   string SubjectXml = subject.CreateAndRetrieve(userAuth, strSubjectXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMSubject Class
  • UpdateAndRetrieve


CRMSubject.Delete Method

The Delete method deletes a subject and then re-links all child subjects. If the subject has a child object, such as a knowledge base article that references it, the delete operation fails.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal SubjectId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  SubjectId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  SubjectId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteSubject privilege to perform this action. See CUserAuth.
SubjectId
Specifies the ID of the subject to delete.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSubject proxy object
Microsoft.Crm.Platform.Proxy.CRMSubject subject = new Microsoft.Crm.Platform.Proxy.CRMSubject();
subject.Credentials = System.Net.CredentialCache.DefaultCredentials;
subject.Url = strDir + "CRMSubject.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSubjectId = "{E4735CBC-A539-4B8C-B848-0C3C94E19BA6}";

   // Delete the subject
   subject.Delete (userAuth, strSubjectId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSubject Class


CRMSubject.Retrieve Method

The Retrieve method retrieves an existing subject.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal SubjectId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  SubjectId,
  string  ColumnSetXML
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  SubjectId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadSubject privilege to perform this action. See CUserAuth.
SubjectId
Specifies the ID of the subject.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in subject.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the requested subject. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. The XML schema is described by subject.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSubject proxy object
Microsoft.Crm.Platform.Proxy.CRMSubject subject = new Microsoft.Crm.Platform.Proxy.CRMSubject();
subject.Credentials = System.Net.CredentialCache.DefaultCredentials;
subject.Url = strDir + "CRMSubject.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSubjectId = "{E4735CBC-A539-4B8C-B848-0C3C94E19BA6}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the subject
   string strSubjectXml = subject.Retrieve(userAuth, strSubjectId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSubject Class
  • RetrieveByParent
  • RetrieveRootNodes


CRMSubject.RetrieveByParent Method

The RetrieveByParent method retrieves all child subjects for the specified parent subject.

Syntax

[Visual Basic .NET]
Public Function RetrieveByParent(
  ByVal Caller As CUserAuth,
  ByVal ParentSubjectId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveByParent(
  CUserAuth  Caller,
  string  ParentSubjectId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveByParent(
  CUserAuth*  Caller,
  String*  ParentSubjectId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadSubject privilege to perform this action. See CUserAuth.
ParentSubjectId
Specifies the ID of the parent subject.
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returna all columns. You can find the valid column names in subject.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of subjects requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<subjects> + subject1..N + </subjects>

where the XML schema for each subject is described by subject.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSubject proxy object
Microsoft.Crm.Platform.Proxy.CRMSubject subject = new Microsoft.Crm.Platform.Proxy.CRMSubject();
subject.Credentials = System.Net.CredentialCache.DefaultCredentials;
subject.Url = strDir + "CRMSubject.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strParentSubjectId = "{K3489CBC-A539-4C8C-A848-0C3C94E19BA6}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve subjects by parent subject
   string strSubjectXml = subject.RetrieveByParent(userAuth, strParentSubjectId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSubject Class
  • Retrieve


CRMSubject.RetrieveRootNodes Method

The RetrieveRootNodes method retrieves all root nodes for the specified organization. Root nodes are subjects whose parent subject is NULL.

Syntax

[Visual Basic .NET]
Public Function RetrieveRootNodes(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal Mask As UInt32,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveRootNodes(
  CUserAuth  Caller,
  string  OrganizationId,
  uint  Mask,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveRootNodes(
  CUserAuth*  Caller,
  String*  OrganizationId,
  unsigned long  Mask,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadSubject privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
Mask
Specifies the feature mask (Incident, KBArticle, ...).
ColumnSetXML
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in subject.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of subjects requested. The fields that are returned depend on what fields are specified in the ColumnSetXML parameter. This XML string is in the format

<subjects> + subject1..N + </subjects>

where the XML schema for each subject is described by subject.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSubject proxy object
Microsoft.Crm.Platform.Proxy.CRMSubject subject = new Microsoft.Crm.Platform.Proxy.CRMSubject();
subject.Credentials = System.Net.CredentialCache.DefaultCredentials;
subject.Url = strDir + "CRMSubject.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strOrgId = "{E4735CBC-A539-4B8C-B848-0C3C94E19BA6}";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>title</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the root nodes
   string strResultsXml = subject.RetrieveRootNodes(userAuth, strOrgId, 1, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMSubject Class
  • Retrieve


CRMSubject.Update Method

The Update method updates an existing subject.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal SubjectId As String,
  ByVal SubjectXML As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  SubjectId,
  string  SubjectXML
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  SubjectId,
  String*  SubjectXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteSubject privilege to perform this action. See CUserAuth.
SubjectId
Specifies the ID of the subject to update.
SubjectXML
Specifies an XML string containing the subject information. The XML schema is described by subject.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSubject proxy object
Microsoft.Crm.Platform.Proxy.CRMSubject subject = new Microsoft.Crm.Platform.Proxy.CRMSubject();
subject.Credentials = System.Net.CredentialCache.DefaultCredentials;
subject.Url = strDir + "CRMSubject.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSubjectId = "{E4735CBC-A539-4B8C-B848-0C3C94E19BA6}";

   // Set up the XML string for the subject
   string strSubjectXml = "<subject>";
   strSubjectXml += "<title>Title 2</title>";
   strSubjectXml += "<description>description2</description>";
   strSubjectXml += "</subject>";

   // Now update the subject
   subject.Update(userAuth, strSubjectId, strSubjectXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMSubject Class
  • UpdateAndRetrieve


CRMSubject.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a subject and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal SubjectId As String,
  ByVal SubjectXML As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  SubjectId,
  string  SubjectXML
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  SubjectId,
  String*  SubjectXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteSubject and prvReadSubject privileges to perform this action. See CUserAuth.
SubjectId
Specifies the ID of the subject that is to be updated.
SubjectXML
Specifies an XML string containing the subject information. The XML schema is described by subject.xsd.

Return Value

Returns a String type that specifies the XML data containing the requested subject. The XML schema is described by subject.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMSubject proxy object
Microsoft.Crm.Platform.Proxy.CRMSubject subject = new Microsoft.Crm.Platform.Proxy.CRMSubject();
subject.Credentials = System.Net.CredentialCache.DefaultCredentials;
subject.Url = strDir + "CRMSubject.srf";

string strErrorMsg;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   string strSubjectId = "{E4735CBC-A539-4B8C-B848-0C3C94E19BA6}";

   // Set up the XML string to update the subject
   string strSubjectXml = "<subject>";
   strSubjectXml += "<title>title 2</title>";
   strSubjectXml += "<description>description2</description>";
   strSubjectXml += "</subject>";

   // Now update the subject
   string strResultsXml = subject.UpdateAndRetrieve (userAuth, strSubjectId, strSubjectXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMSubject Class
  • Update


CRMTerritory Class

The CRMTerritory class contains methods that you can use to manage territories.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMTerritory
[Visual Basic .NET]
Public Class CRMTerritory
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMTerritory : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMTerritory: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMTerritory class exposes the following methods.

Method | Description
Create | Creates a territory.
CreateAndRetrieve | Creates a territory and then retrieves it.
Delete | Deletes a territory.
Retrieve | Retrieves a territory.
RetrieveByObject | Retrieves all territories that are associated with an object (organization).
Update | Updates a territory.
UpdateAndRetrieve | Updates a territory and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMTerritory.Create Method

The Create method creates a territory.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal EntityXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  EntityXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  EntityXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateTerritory privilege to perform this action. See CUserAuth.
EntityXML
Specifies an XML string representing the territory. The XML schema is described by territory.xsd.

Return Value

Returns a String type that specifies the ID of the newly created territory.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMTerritory proxy object
Microsoft.Crm.Platform.Proxy.CRMTerritory    territory = new Microsoft.Crm.Platform.Proxy.CRMTerritory();
territory.Credentials = System.Net.CredentialCache.DefaultCredentials;
territory.Url = strDir + "CRMTerritory.srf";

string strErrorMsg;
string strOrganizationId = "{B2BB383D-C9F2-4235-98DE-4A59F7569432}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the territory
   string xml = "<territory>";
   xml += "<name>Territory1 </name>";
   xml += "<organizationid>" + strOrganizationId + "</organizationid>";
   xml += "<managerid>" + userAuth.UserId + "</managerid>";
   xml += "</territory>";

   // Create the territory
   string strTerritoryId = territory.Create (userAuth, xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMTerritory Class
  • Update


CRMTerritory.CreateAndRetrieve Method

The CreateAndRetrieve method creates a territory and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityXml As String,
  ByVal ColumnSet As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  EntityXml,
  string  ColumnSet
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  EntityXml,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateTerritory and prvReadTerritory privileges to perform this action. See CUserAuth.
EntityXml
Specifies an XML string representing the territory. The XML schema is described by territory.xsd.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in territory.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the territory information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by territory.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMTerritory proxy object
Microsoft.Crm.Platform.Proxy.CRMTerritory    territory = new Microsoft.Crm.Platform.Proxy.CRMTerritory();
territory.Credentials = System.Net.CredentialCache.DefaultCredentials;
territory.Url = strDir + "CRMTerritory.srf";

string strErrorMsg;
string strOrganizationId = "{B2BB383D-C9F2-4235-98DE-4A59F7569432}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the territory
   string xml = "<territory>";
   xml += "<name>Territory1 </name>";
   xml += "<organizationid>" + strOrganizationId + "</organizationid>";
   xml += "<managerid>" + userAuth.UserId + "</managerid>";
   xml += "</territory>";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>createdon</column>";
   strColumnSetXml += "</columnset>";

   // Create the territory
   string strResultTerritoryXml = territory.CreateAndRetrieve (userAuth, xml, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMTerritory Class
  • UpdateAndRetrieve


CRMTerritory.Delete Method

The Delete method deletes a territory.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  EntityId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  EntityId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteTerritory privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the territory that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMTerritory proxy object
Microsoft.Crm.Platform.Proxy.CRMTerritory    territory = new Microsoft.Crm.Platform.Proxy.CRMTerritory();
territory.Credentials = System.Net.CredentialCache.DefaultCredentials;
territory.Url = strDir + "CRMTerritory.srf";

string strErrorMsg;
string strTerritoryId = "{465FB749-DF3A-4105-KJ8D-603DB8726496}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the territory
   territory.Delete (userAuth, strTerritoryId);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMTerritory Class


CRMTerritory.Retrieve Method

The Retrieve method retrieves a territory.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal ColumnSet As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  EntityId,
  string  ColumnSet
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadTerritory privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the territory that is to be retrieved.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in territory.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the territory information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by territory.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMTerritory proxy object
Microsoft.Crm.Platform.Proxy.CRMTerritory territory = new Microsoft.Crm.Platform.Proxy.CRMTerritory();
territory.Credentials = System.Net.CredentialCache.DefaultCredentials;
territory.Url = strDir + "CRMTerritory.srf";

string strErrorMsg;
string strTerritoryId = "{465FB749-DF3A-4105-KJ8D-603DB8726496}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>createdon</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the territory
   string strResultsXml = territory.Retrieve (userAuth, strTerritoryId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMTerritory Class
  • RetrieveByObject


CRMTerritory.RetrieveByObject Method

The RetrieveByObject method retrieves all territories that are associated with an object (organization).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Entity As CObjectName,
  ByVal ColumnSet As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Entity,
  string  ColumnSet
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Entity,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadTerritory privilege to perform this action. See CUserAuth.
Entity
Specifies the object (organization). See CObjectName.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in territory.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of territories requested. The fields that are returned depend on what fields are specified in the ColumnSet parameter. This XML string is in the format

<territories> + territory1..N + </territories>

where the XML schema for each territory is described by territory.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMTerritory proxy object
Microsoft.Crm.Platform.Proxy.CRMTerritory territory = new Microsoft.Crm.Platform.Proxy.CRMTerritory();
territory.Credentials = System.Net.CredentialCache.DefaultCredentials;
territory.Url = strDir + "CRMTerritory.srf";

string strErrorMsg;
string strOrganizationId = "{B2BB383D-C9F2-4235-98DE-4A59F7569432}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>createdon</column>";
   strColumnSetXml += "</columnset>";

   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strOrganizationId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otOrganization;

   // Retrieve the territories for this organization
   string strResultsXml = territory.RetrieveByObject(userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMTerritory Class
  • Retrieve


CRMTerritory.Update Method

The Update method updates a territory.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal EntityXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  EntityId,
  string  EntityXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  EntityXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteTerritory privilege to perform this action. See CUserAuth.
EntityId
Specifies the ID of the territory that is to be updated.
EntityXml
Specifies an XML string representing the territory. The XML schema is described by territory.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMTerritory proxy object
Microsoft.Crm.Platform.Proxy.CRMTerritory territory = new Microsoft.Crm.Platform.Proxy.CRMTerritory();
territory.Credentials = System.Net.CredentialCache.DefaultCredentials;
territory.Url = strDir + "CRMTerritory.srf";

string strErrorMsg;
string strTerritoryId = "{465FB749-DF3A-4105-KJ8D-603DB8726496}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the territory
   string xml = "<territory>";
   xml += "<name>Territory2</name>";
   xml += "</territory>";

   // Update the territory
   territory.Update (userAuth, strTerritoryId, xml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMTerritory Class
  • UpdateAndRetrieve


CRMTerritory.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a territory and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal EntityId As String,
  ByVal EntityXml As String,
  ByVal ColumnSet As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  EntityId,
  string  EntityXml,
  string  ColumnSet
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  EntityId,
  String*  EntityXml,
  String*  ColumnSet
);

Parameters

Caller
Specifies the identity of the caller. The caller must have prvWriteTerritory and prvReadTerritory privileges to perform this action. See CUserAuth.
EntityId
Specifies the ID of the territory that is to be updated.
EntityXml
Specifies an XML string representing the territory. The XML schema is described by territory.xsd.
ColumnSet
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in territory.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the territory information. The fields that are returned depend on what fields are specified in the ColumnSet parameter. The XML schema is described by territory.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServerName should be set with the name of the platform Web server
string strServerName = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServerName + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMTerritory proxy object
Microsoft.Crm.Platform.Proxy.CRMTerritory territory = new Microsoft.Crm.Platform.Proxy.CRMTerritory();
territory.Credentials = System.Net.CredentialCache.DefaultCredentials;
territory.Url = strDir + "CRMTerritory.srf";

string strErrorMsg;
string strTerritoryId = "{465FB749-DF3A-4105-KJ8D-603DB8726496}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the territory
   string xml = "<territory>";
   xml += "<name>Territory2</name>";
   xml += "</territory>";

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "<column>createdon</column>";
   strColumnSetXml += "</columnset>";

   // Update the territory, and then retrieve it
   string resultXml = territory.UpdateAndRetrieve (userAuth, strTerritoryId, xml, strColumnSetXml);

}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMTerritory Class
  • Update


CRMUoM Class

The CRMUoM class contains methods that you can use to manage unit of measure objects.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMUoM
[Visual Basic .NET]
Public Class CRMUoM
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMUoM : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMUoM: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMUoM class exposes the following methods.

Method | Description
Create | Creates a unit of measure.
CreateAndRetrieve | Creates a unit of measure and then retrieves it.
Delete | Deletes a unit of measure.
Retrieve | Retrieves a unit of measure.
RetrieveByObject | Retrieves all units of measure that are associated with an object (unit of measure schedule).
RetrieveByProductPriceLevel | Retrieves all units of measure that are associated with a product and price level combination.
Update | Updates a unit of measure.
UpdateAndRetrieve | Updates a unit of measure and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMUoM.Create Method

The Create method creates a unit of measure.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal UoMXml As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  UoMXml
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  UoMXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct privilege to perform this action. See CUserAuth.
UoMXml
Specifies an XML string representing the unit of measure. The XML schema is described by uom.xsd.

Return Value

Returns a String type that specifies the ID of the unit of newly created unit of measure object.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMUoM proxy object
Microsoft.Crm.Platform.Proxy.CRMUoM   uom = new Microsoft.Crm.Platform.Proxy.CRMUoM();
uom.Credentials = System.Net.CredentialCache.DefaultCredentials;
uom.Url = strDir + "CRMUom.srf";

string strErrorMsg;
string strXml;
string strUoMScheduleId = "{1DF3CF17-543F-47D2-9A2F-8F6810B561EF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the UoM
   strXml = "<uom><name>Dozen</name>";
   strXml += "<uomscheduleid>" + strUoMScheduleId + "</uomscheduleid>";
   strXml += "<quantity>12</quantity>";
   strXml += "</uom>";

   // Create the UoM
   string strUoMId = uom.Create (userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMUoM Class
  • Update


CRMUoM.CreateAndRetrieve Method

The CreateAndRetrieve method creates a unit of measure and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InUoMXml As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InUoMXml
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InUoMXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct and prvReadProduct privileges to perform this action. See CUserAuth.
InUoMXml
Specifies an XML string representing the unit of measure. The XML schema is described by uom.xsd.

Return Value

Returns a String type that specifies the XML data containing the unit of measure information. The XML schema is described by uom.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMUoM proxy object
Microsoft.Crm.Platform.Proxy.CRMUoM   uom = new Microsoft.Crm.Platform.Proxy.CRMUoM();
uom.Credentials = System.Net.CredentialCache.DefaultCredentials;
uom.Url = strDir + "CRMUom.srf";

string strErrorMsg;
string strXml;
string strUoMId = "{1DF3CF17-543F-47D2-9A2F-8F6810B561EF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the UoM
   strXml = "<uom><name>HalfDozen</name>";
   strXml += "<uomscheduleid>" + strUoMId + "</uomscheduleid>";
   strXml += "<quantity>6</quantity>";
   strXml += "</uom>";

   // Create the UoM, and then retrieve it
   string strUoMXml = uom.CreateAndRetrieve (userAuth, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMUoM Class
  • UpdateAndRetrieve


CRMUoM.Delete Method

The Delete method deletes a unit of measure.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal UoMId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  UoMId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  UoMId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteProduct privilege to perform this action. See CUserAuth.
UoMId
Specifies the ID of the unit of measure object that is to be deleted.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMUoM proxy object
Microsoft.Crm.Platform.Proxy.CRMUoM   uom = new Microsoft.Crm.Platform.Proxy.CRMUoM();
uom.Credentials = System.Net.CredentialCache.DefaultCredentials;
uom.Url = strDir + "CRMUom.srf";

string strErrorMsg;
string strUoMId = "{E0B38CBE-91BB-4863-8F4F-76785CE705D2}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the UoM
   uom.Delete (userAuth, strUoMId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMUoM Class


CRMUoM.Retrieve Method

The Retrieve method retrieves a unit of measure.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal UoMId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  UoMId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  UoMId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
UoMId
Specifies the ID of the unit of measure object.
ColumnSetXml
Specifies an XML string describing the set of columns that are to be retrieved. Passing "" or null returns all columns. You can find the valid column names in uom.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the unit of measure information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by uom.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMUoM proxy object
Microsoft.Crm.Platform.Proxy.CRMUoM   uom = new Microsoft.Crm.Platform.Proxy.CRMUoM();
uom.Credentials = System.Net.CredentialCache.DefaultCredentials;
uom.Url = strDir + "CRMUom.srf";

string strErrorMsg;
string strUoMId = "{E0B38CBE-91BB-4863-8F4F-76785CE705D2}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>quantity</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the UoM
   string strResultsXml = uom.Retrieve (userAuth, strUoMId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMUoM Class
  • RetrieveByObject
  • RetrieveByProductPriceLevel


CRMUoM.RetrieveByObject Method

The RetrieveByObject method retrieves all units of measure that are associated with an object (unit of measure schedule).

Syntax

[Visual Basic .NET]
Public Function RetrieveByObject(
  ByVal Caller As CUserAuth,
  ByVal Object As CObjectName,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByObject(
  CUserAuth  Caller,
  CObjectName  Object,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByObject(
  CUserAuth*  Caller,
  CObjectName*  Object,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
Object
Specifies the object (unit of measure schedule) for which you want to retrieve associated unit of measure objects. See CObjectName.
ColumnSetXml
Specifies an XML string describing the set of columns that are to be retrieved. Passing "" or null returns all columns. You can find the valid column names in uom.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of unit of measure objects requested. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<uoms> + uom1..N + </uoms>

where the XML schema for each unit of measure is described by uom.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMUoM proxy object
Microsoft.Crm.Platform.Proxy.CRMUoM   uom = new Microsoft.Crm.Platform.Proxy.CRMUoM();
uom.Credentials = System.Net.CredentialCache.DefaultCredentials;
uom.Url = strDir + "CRMUom.srf";

string strErrorMsg;
string strUoMScheduleId = "{1DF3CF17-543F-47D2-9A2F-8F6810B561EF}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>quantity</column>";
   strColumnSetXml += "</columnset>";

   // Initialize the schedule object
   Microsoft.Crm.Platform.Proxy.CObjectName objName = new Microsoft.Crm.Platform.Proxy.CObjectName();
   objName.Id = strUoMScheduleId;
   objName.Type = Microsoft.Crm.Platform.Proxy.ObjectType.otUoMSchedule;

   // Retrieve the UoM by schedule
   string strResultsXml = uom.RetrieveByObject (userAuth, objName, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMUoM Class
  • Retrieve
  • RetrieveByProductPriceLevel


CRMUoM.RetrieveByProductPriceLevel Method

The RetrieveByProductPriceLevel method retrieves all units of measure that are associated with a product and price level combination.

Syntax

[Visual Basic .NET]
Public Function RetrieveByProductPriceLevel(
  ByVal Caller As CUserAuth,
  ByVal ProductId As String,
  ByVal PriceLevelId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByProductPriceLevel(
  CUserAuth  Caller,
  string  ProductId,
  string  PriceLevelId,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByProductPriceLevel(
  CUserAuth*  Caller,
  String*  ProductId,
  String*  PriceLevelId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
ProductId
Specifies the ID of the product.
PriceLevelId
Specifies the ID of the price level.
ColumnSetXml
Specifies an XML string describing the set of columns that are to be retrieved. Passing "" or null returns all columns. You can find the valid column names in uom.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the set of unit of measure objects requested. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. This XML string is in the format

<uoms> + uom1..N + </uoms>

where the XML schema for each unit of measure is described by uom.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMUoM proxy object
Microsoft.Crm.Platform.Proxy.CRMUoM   uom = new Microsoft.Crm.Platform.Proxy.CRMUoM();
uom.Credentials = System.Net.CredentialCache.DefaultCredentials;
uom.Url = strDir + "CRMUom.srf";

string strErrorMsg;
string strProductId = "{9BA55E02-89B9-4257-B541-07F926E03B0B}";
string strPriceLevelId = "{63FE40BC-B59B-43C5-A856-82DDC400E25B}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>quantity</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the UoMs by product price level
   string strResultsXml = uom.RetrieveByProductPriceLevel  (userAuth, strProductId, strPriceLevelId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMUoM Class
  • Retrieve
  • RetrieveByObject


CRMUoM.Update Method

The Update method updates a unit of measure.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal UoMId As String,
  ByVal UoMXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  UoMId,
  string  UoMXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  UoMId,
  String*  UoMXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
UoMId
Specifies the ID of the unit of measure object that is to be updated.
UoMXml
Specifies an XML string representing the unit of measure. The XML schema is described by uom.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMUoM proxy object
Microsoft.Crm.Platform.Proxy.CRMUoM   uom = new Microsoft.Crm.Platform.Proxy.CRMUoM();
uom.Credentials = System.Net.CredentialCache.DefaultCredentials;
uom.Url = strDir + "CRMUom.srf";

string strErrorMsg;
string strXml;
string strUoMId = "{E0B38CBE-91BB-4863-8F4F-76785CE705D2}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the UoM
   strXml = "<uom><name>QDozen</name>";
   strXml += "<quantity>4</quantity>";
   strXml += "</uom>";

   // Update the UoM
   uom.Update (userAuth, strUoMId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMUoM Class
  • UpdateAndRetrieve


CRMUoM.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a unit of measure and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal UoMId As String,
  ByVal InUoMXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  UoMId,
  string  InUoMXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  UoMId,
  String*  InUoMXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct and prvReadProduct privileges to perform this action. See CUserAuth.
UoMId
Specifies the ID of the unit of measure object.
InUoMXml
Specifies an XML string representing the unit of measure. The XML schema is described by uom.xsd.

Return Value

Returns a String type that specifies the XML data containing the unit of measure information. The XML schema is described by uom.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMUoM proxy object
Microsoft.Crm.Platform.Proxy.CRMUoM   uom = new Microsoft.Crm.Platform.Proxy.CRMUoM();
uom.Credentials = System.Net.CredentialCache.DefaultCredentials;
uom.Url = strDir + "CRMUom.srf";

string strErrorMsg;
string strXml;
string strUoMId = "{E0B38CBE-91BB-4863-8F4F-76785CE705D2}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the UoM
   strXml = "<uom><name>HDozen</name>";
   strXml += "<quantity>6</quantity>";
   strXml += "</uom>";

   // Update the UoM
   string strResultsXml = uom.UpdateAndRetrieve (userAuth, strUoMId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMUoM Class
  • Update


CRMUoMSchedule Class

The CRMUoMSchedule class contains methods that you can use to manage unit of measure schedules.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  CRMUoMSchedule
[Visual Basic .NET]
Public Class CRMUoMSchedule
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class CRMUoMSchedule : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class CRMUoMSchedule: public System.Web.Services.Protocols.SoapHttpClientProtocol

The CRMUoMSchedule class exposes the following methods.

Method | Description
Create | Creates a unit of measure schedule.
CreateAndRetrieve | Creates a unit of measure schedule and then retrieves it.
Delete | Deletes a unit of measure schedule.
Retrieve | Retrieves a unit of measure schedule.
RetrieveByOrganization | Retrieves all unit of measure schedules that are associated with an organization.
Update | Updates a unit of measure schedule.
UpdateAndRetrieve | Updates a unit of measure schedule and then retrieves it.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


CRMUoMSchedule.Create Method

The Create method creates a unit of measure schedule.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal UoMScheduleXml As String,
  ByVal BaseUoMName As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  UoMScheduleXml,
  string  BaseUoMName
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  UoMScheduleXml,
  String*  BaseUoMName
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct privilege to perform this action. See CUserAuth.
UoMScheduleXml
Specifies an XML string representing the unit of measure schedule. The XML schema is described by uomschedule.xsd.
BaseUoMName
Specifies the name of the base unit of measure.

Return Value

Returns a String type that specifies the ID of the unit of measure schedule.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMUoMSchedule  uomschedule = new Microsoft.Crm.Platform.Proxy.CRMUoMSchedule();
uomschedule.Credentials = System.Net.CredentialCache.DefaultCredentials;
uomschedule.Url = strDir + "CRMUomschedule.srf";

string strErrorMsg;
string strXml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the UoM schedule
   strXml = "<uomschedule> <name>TestUoMSchedule</name>";
   strXml += "</uomschedule>";

   // Create the UoM schedule
   string uomScheduleId = uomschedule.Create (userAuth, strXml,"Base Name");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMUoMSchedule Class
  • Update


CRMUoMSchedule.CreateAndRetrieve Method

The CreateAndRetrieve method creates a unit of measure schedule and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InUoMScheduleXml As String,
  ByVal BaseUoMName As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InUoMScheduleXml,
  string  BaseUoMName
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InUoMScheduleXml,
  String*  BaseUoMName
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateProduct and prvReadProduct privileges to perform this action. See CUserAuth.
InUoMScheduleXml
Specifies an XML string representing the unit of measure schedule. The XML schema is described by uomschedule.xsd.
BaseUoMName
Specifies the name of the base unit of measure.

Return Value

Returns a String type that specifies the XML data containing the unit of measure schedule information. The XML schema is described by uomschedule.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMUoMSchedule  uomschedule = new Microsoft.Crm.Platform.Proxy.CRMUoMSchedule();
uomschedule.Credentials = System.Net.CredentialCache.DefaultCredentials;
uomschedule.Url = strDir + "CRMUomschedule.srf";

string strErrorMsg;
string strXml;

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the UoM schedule
   strXml = "<uomschedule>";
   strXml += "<name>TestUoMSchedule1</name>";
   strXml += "</uomschedule>";

   // Create the UoM schedule, and then retrieve it
   string strUoMScheduleXml = uomschedule.CreateAndRetrieve (userAuth, strXml, "Base Name");
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMUoMSchedule Class
  • UpdateAndRetrieve


CRMUoMSchedule.Delete Method

The Delete method deletes a unit of measure schedule.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal UoMScheduleId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  UoMScheduleId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  UoMScheduleId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteProduct privilege to perform this action. See CUserAuth.
UoMScheduleId
Specifies the ID of the unit of measure schedule.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMUoMSchedule  uomschedule = new Microsoft.Crm.Platform.Proxy.CRMUoMSchedule();
uomschedule.Credentials = System.Net.CredentialCache.DefaultCredentials;
uomschedule.Url = strDir + "CRMUomschedule.srf";

string strErrorMsg;
string strUoMScheduleId = "{8B2087B8-1A20-4B35-8F30-F1F3BC2D7C5C}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Delete the UoM schedule
   uomschedule.Delete (userAuth, strUoMScheduleId);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMUoMSchedule Class


CRMUoMSchedule.Retrieve Method

The Retrieve method retrieves a unit of measure schedule.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal UoMScheduleId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  UoMScheduleId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  UoMScheduleId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
UoMScheduleId
Specifies the ID of the unit of measure schedule.
ColumnSetXml
Specifies an XML string describing the set of columns that are to be retrieved. Passing "" or null returns all columns. You can find the valid column names in uomschedule.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data containing the unit of measure schedule information. The fields that are returned depend on what fields are specified in the ColumnSetXml parameter. The XML schema is described by uomschedule.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMUoMSchedule  uomschedule = new Microsoft.Crm.Platform.Proxy.CRMUoMSchedule();
uomschedule.Credentials = System.Net.CredentialCache.DefaultCredentials;
uomschedule.Url = strDir + "CRMUomschedule.srf";

string strErrorMsg;
string strUoMScheduleId = "{8B2087B8-1A20-4B35-8F30-F1F3BC2D7C5C}";
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the UoM schedule
   string strResultsXml = uomschedule.Retrieve (userAuth, strUoMScheduleId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMUoMSchedule Class
  • RetrieveByOrganization


CRMUoMSchedule.RetrieveByOrganization Method

The RetrieveByOrganization method retrieves all unit of measure schedules that are associated with a specific organization.

Syntax

[Visual Basic .NET]
Public Function RetrieveByOrganization(
  ByVal Caller As CUserAuth,
  ByVal OrganizationId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string RetrieveByOrganization(
  CUserAuth  Caller,
  string  OrganizationId,
  string  ColumnSetXml
);
[C++]
public: String* RetrieveByOrganization(
  CUserAuth*  Caller,
  String*  OrganizationId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadProduct privilege to perform this action. See CUserAuth.
OrganizationId
Specifies the ID of the organization.
ColumnSetXml
Specifies an XML string describing the set of columns that is to be retrieved. Passing "" or null returns all columns. You can find the valid column names in uomschedule.xsd.

Return Value

Returns a String type that specifies the XML data containing the set of unit of measure schedules requested. This XML string is in the format

<uomschedules> + uomschedule1..N + </uomschedules>

where the XML schema for each unit of measure schedule is described by uomschedule.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMUoMSchedule  uomschedule = new Microsoft.Crm.Platform.Proxy.CRMUoMSchedule();
uomschedule.Credentials = System.Net.CredentialCache.DefaultCredentials;
uomschedule.Url = strDir + "CRMUomschedule.srf";

string strErrorMsg;
string strOrgId = "{3BECB6A6-0DD8-4061-98D9-0B9E897C5027
try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>description</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the UoM schedules for the organization
   string strResultsXml = uomschedule.RetrieveByOrganization (userAuth, strOrgId, strColumnSetXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CRMUoMSchedule Class
  • Retrieve


CRMUoMSchedule.Update Method

The Update method updates a unit of measure schedule.

Syntax

[Visual Basic .NET]
Public Sub Update(
  ByVal Caller As CUserAuth,
  ByVal UoMScheduleId As String,
  ByVal UoMScheduleXml As String
)
[C#]
public void Update(
  CUserAuth  Caller,
  string  UoMScheduleId,
  string  UoMScheduleXml
);
[C++]
public: void Update(
  CUserAuth*  Caller,
  String*  UoMScheduleId,
  String*  UoMScheduleXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct privilege to perform this action. See CUserAuth.
UoMScheduleId
Specifies the ID of the unit of measure schedule.
UoMScheduleXml
Specifies an XML string representing the unit of measure schedule. The XML schema is described by uomschedule.xsd.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMUoMSchedule  uomschedule = new Microsoft.Crm.Platform.Proxy.CRMUoMSchedule();
uomschedule.Credentials = System.Net.CredentialCache.DefaultCredentials;
uomschedule.Url = strDir + "CRMUomschedule.srf";

string strErrorMsg;
string strXml;
string strUoMScheduleId = "{8B2087B8-1A20-4B35-8F30-F1F3BC2D7C5C}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the UoM schedule
   strXml = "<uomschedule> <name>TestUoMSchedule</name>";
   strXml += "</uomschedule>";

   // Update the UoM schedule
   uomschedule.Update(userAuth, strUoMScheduleId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • CRMUoMSchedule Class
  • UpdateAndRetrieve


CRMUoMSchedule.UpdateAndRetrieve Method

The UpdateAndRetrieve method updates a unit of measure schedule and then retrieves it.

Syntax

[Visual Basic .NET]
Public Function UpdateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal UoMScheduleId As String,
  ByVal InUoMScheduleXml As String
) As String
[C#]
public string UpdateAndRetrieve(
  CUserAuth  Caller,
  string  UoMScheduleId,
  string  InUoMScheduleXml
);
[C++]
public: String* UpdateAndRetrieve(
  CUserAuth*  Caller,
  String*  UoMScheduleId,
  String*  InUoMScheduleXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteProduct and prvReadProduct privileges to perform this action. See CUserAuth.
UoMScheduleId
Specifies the ID of the unit of measure schedule.
InUoMScheduleXml
Specifies an XML string representing the unit of measure schedule. The XML schema is described by uomschedule.xsd.

Return Value

Returns a String type that specifies the XML data containing the unit of measure schedule information. The XML schema is described by uomschedule.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// virtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string virtualDirectory = "mscrmservices";
string strDir = "http://" + strServer + "/" + virtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser ();
bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
bizUser.Url = strDir + "BizUser.srf";

// CRMPriceLevel proxy object
Microsoft.Crm.Platform.Proxy.CRMUoMSchedule  uomschedule = new Microsoft.Crm.Platform.Proxy.CRMUoMSchedule();
uomschedule.Credentials = System.Net.CredentialCache.DefaultCredentials;
uomschedule.Url = strDir + "CRMUomschedule.srf";

string strErrorMsg;
string strXml;
string strUoMScheduleId = "{8B2087B8-1A20-4B35-8F30-F1F3BC2D7C5C}";

try
{
   Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();

   // Set up the XML string for the UoM schedule
   strXml = "<uomschedule> <name>TestUoMSchedule</name>";
   strXml += "</uomschedule>";

   // Update the UoM schedule, and then retrieve it
   string strResultsXml = uomschedule.UpdateAndRetrieve (userAuth, strUoMScheduleId, strXml);
}
catch (System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch (Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • CRMUoMSchedule Class
  • Update


SecRole Class

The SecRole class contains methods that you can use to manage security roles.

There are no properties for this class.

For more information about using XML, see the XML Document Object Model at msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconxmldocumentobjectmodeldom.asp.

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Web.Services.Protocols.WebClientProtocol
            System.Web.Services.Protocols.HttpWebClientProtocol
               System.Web.Services.Protocols.SoapHttpClientProtocol
                  SecRole
[Visual Basic .NET]
Public Class SecRole
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
[C#]
public class SecRole : System.Web.Services.Protocols.SoapHttpClientProtocol
[C++]
public __gc class SecRole: public System.Web.Services.Protocols.SoapHttpClientProtocol

The SecRole class exposes the following methods.

Method | Description
AddPrivileges | Adds a set of existing privileges to an existing role.
AssignUserRoles | Adds an existing user to an array of existing roles.
AssignUsersToRoles | Adds an array of existing users to an array of existing roles.
ChangeName | Changes the name of an existing role.
Create | Creates a new role.
CreateAndRetrieve | Creates a new role and then returns the complete XML data for the newly created role.
Delete | Deletes a role.
RemovePrivilege | Removes a privilege from an existing role.
RemoveUserRoles | Removes an existing user from an existing role.
ReplacePrivileges | Replaces the privilege set of an existing role.
Retrieve | Retrieves a role.
RetrieveAllRoles | Retrieves all roles for the specified business unit.
RetrieveIdFromName | Retrieves the ID for the role with a specified name in a specified business unit.
RetrieveRolePrivileges | Retrieves the privileges that are assigned to the specified role.
RetrieveRoleUsers | Retrieves the users that are assigned to the specified role.
RetrieveUserRoles | Retrieves all roles for the specified user.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Classes


SecRole.AddPrivileges Method

The AddPrivileges method adds a set of existing privileges to an existing role.

Syntax

[Visual Basic .NET]
Public Sub AddPrivileges(
  ByVal Caller As CUserAuth,
  ByVal RoleId As String,
  ByVal Privileges As CRolePrivilege()
)
[C#]
public void AddPrivileges(
  CUserAuth  Caller,
  string  RoleId,
  CRolePrivilege[]  Privileges
);
[C++]
public: void AddPrivileges(
  CUserAuth*  Caller,
  String*  RoleId,
  CRolePrivilege*  Privileges __gc[]
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteRole privilege to perform this action. See CUserAuth.
RoleId
Specifies the ID of the role to which the privilege is being added. This ID is specified by the platform and is obtained at creation time or by a bulk retrieve.
Privileges
Specifies an array containing the IDs and depths of the privileges that are being added. Each CRolePrivilege structure should contain one string privilege ID. Privilege IDs can be obtained by calling the BizPrivilege::RetrievePrivilegeSet method. See CRolePrivilege.

Return Value

No return value.

Remarks

AddPrivileges fails if a privilege is added that already exists in the role, even if the depth is different. To replace a privilege, the ReplacePrivileges method should be used.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strSecRoleXML = "";
string strRoleId = "";
string strErrorMsg = "";

try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Set up the XML string for the role in the business unit of the caller
   strSecRoleXML = "<role>" +
      "<name>Custom Security Role Name</name>" +
      "<businessunitid>" + userAuth.MerchantId + "</businessunitid>" +
      "</role>";

   // Create a custom role
   // The method returns the ID of the newly created role
   strRoleId = secRole.Create(userAuth, strSecRoleXML);

   // Create an array of privileges to add to the desired role
   Microsoft.Crm.Platform.Proxy.CRolePrivilege[] rolePrivileges = new Microsoft.Crm.Platform.Proxy.CRolePrivilege[3];
   for (int i=0;i<3;i++)
   {
      rolePrivileges[i] = new Microsoft.Crm.Platform.Proxy.CRolePrivilege();
   }

   // prvCreateAccount
   rolePrivileges[0].Depth = Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH.BASIC;
   rolePrivileges[0].PrivilegeId = "{D26FE964-230B-42DD-AD93-5CC879DE411E}";

   // prvReadAccount
   rolePrivileges[1].Depth = Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH.DEEP;
   rolePrivileges[1].PrivilegeId = "{886B280C-6396-4D56-A0A3-2C1B0A50CEB0}";

   // prvWriteAccount
   rolePrivileges[2].Depth = Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH.GLOBAL;
   rolePrivileges[2].PrivilegeId = "{7863E80F-0AB2-4D67-A641-37D9F342C7E3}";

   // Add a privilege to the role
   secRole.AddPrivileges(userAuth, strRoleId, rolePrivileges);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • SecRole Class


SecRole.AssignUserRoles Method

The AssignUserRoles method adds an existing user to an array of existing roles.

Syntax

[Visual Basic .NET]
Public Sub AssignUserRoles(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal RoleIds As String()
)
[C#]
public void AssignUserRoles(
  CUserAuth  Caller,
  string  UserId,
  string[]  RoleIds
);
[C++]
public: void AssignUserRoles(
  CUserAuth*  Caller,
  String*  UserId,
  String*  RoleIds __gc[]
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignRole privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user being assigned to the roles. This ID is specified by the platform and is obtained at user creation time or by a bulk retrieve.
RoleIds
Specifies an array of IDs for the roles to which the user is being assigned. This is a simple array of strings, each of which contains one role ID.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Retrieve the role ID by name
   string strRoleId = secRole.RetrieveIdFromName(userAuth, userAuth.MerchantId, "Salesperson");
   if (strRoleId != null)
   {
      string[] roles = new string[1];
      roles[0] = strRoleId;

      // Assign each of the roles to the user
      secRole.AssignUserRoles(userAuth, userAuth.UserId, roles);
   }
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • SecRole Class


SecRole.AssignUsersToRoles Method

The AssignUsersToRoles method adds an array of existing users to an array of existing roles.

Syntax

[Visual Basic .NET]
Public Sub AssignUsersToRoles(
  ByVal Caller As CUserAuth,
  ByVal UserIds As String(),
  ByVal RoleIds As String()
)
[C#]
public void AssignUsersToRoles(
  CUserAuth  Caller,
  string[]  UserIds,
  string[]  RoleIds
);
[C++]
public: void AssignUsersToRoles(
  CUserAuth*  Caller,
  String*  UserIds __gc[],
  String*  RoleIds __gc[]
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignRole privilege to perform this action. See CUserAuth.
UserIds
Specifies an array of user IDs to assign to the specified roles. This is an array of strings, each of which contains one user ID.
RoleIds
Specifies an array of IDs for the roles to which the user is being assigned. This is an array of strings, each of which contains one role ID.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Retrieve the role ID by name
   string strRoleId = secRole.RetrieveIdFromName(userAuth, userAuth.MerchantId, "Sales Manager");
   if (strRoleId != null)
   {
      string[] users = new string[1];
      users[0] = userAuth.UserId;

      string[] roles = new string[1];
      roles[0] = strRoleId;

      // Assign each of the roles to each of the users
      secRole.AssignUsersToRoles(userAuth, users, roles);
   }
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • SecRole Class


SecRole.ChangeName Method

The ChangeName method changes the name of an existing role.

Syntax

[Visual Basic .NET]
Public Sub ChangeName(
  ByVal Caller As CUserAuth,
  ByVal RoleId As String,
  ByVal NewName As String
)
[C#]
public void ChangeName(
  CUserAuth  Caller,
  string  RoleId,
  string  NewName
);
[C++]
public: void ChangeName(
  CUserAuth*  Caller,
  String*  RoleId,
  String*  NewName
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteRole privilege to perform this action. See CUserAuth.
RoleId
Specifies the ID of the role whose name is being changed. This ID is specified by the platform and is obtained at creation time or by a bulk retrieve.
NewName
Specifies the new name for the role.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Retrieve the role ID by name
   string strRoleId = secRole.RetrieveIdFromName(userAuth, userAuth.MerchantId, "My Custom Role Name");
   if (strRoleId != null)
      // Change the name
      secRole.ChangeName(userAuth, strRoleId, "Another New Role Name");
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • SecRole Class


SecRole.Create Method

The Create method creates a new role.

Syntax

[Visual Basic .NET]
Public Function Create(
  ByVal Caller As CUserAuth,
  ByVal RoleXML As String
) As String
[C#]
public string Create(
  CUserAuth  Caller,
  string  RoleXML
);
[C++]
public: String* Create(
  CUserAuth*  Caller,
  String*  RoleXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateRole privilege to perform this action. See CUserAuth.
RoleXML
Specifies an XML string describing the role that is to be created. The role name and the business unit ID are required fields in the XML string. The XML schema is described by role.xsd.

Return Value

Returns a String type that specifies the returned ID of the newly created role.

Remarks

The name field in the parameter RoleXML must contain a unique role name.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strSecRoleXML = "";
string strRoleId = "";
string strErrorMsg = "";

try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Set up the XML string for the role in the business unit of the caller
   strSecRoleXML = "<role>" +
      "<name>Custom Security Role Name</name>" +
      "<businessunitid>" + userAuth.MerchantId + "</businessunitid>" +
      "</role>";

   // Create a custom role
   // The method returns the ID of the newly created role
   strRoleId = secRole.Create(userAuth, strSecRoleXML);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • CreateAndRetrieve
  • SecRole Class


SecRole.CreateAndRetrieve Method

The CreateAndRetrieve method creates a new role and then returns the complete XML data for the newly created role.

Syntax

[Visual Basic .NET]
Public Function CreateAndRetrieve(
  ByVal Caller As CUserAuth,
  ByVal InRoleXML As String
) As String
[C#]
public string CreateAndRetrieve(
  CUserAuth  Caller,
  string  InRoleXML
);
[C++]
public: String* CreateAndRetrieve(
  CUserAuth*  Caller,
  String*  InRoleXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvCreateRole and prvReadRole privileges to perform this action. See CUserAuth.
InRoleXML
Specifies an XML string describing the role that is to be created. The role name and the business unit ID are required fields in the XML string. The XML schema is described by role.xsd.

Return Value

Returns a String type that specifies the XML data describing the returned role. The XML schema is described by role.xsd.

Remarks

The name field in the parameter RoleXML must contain a unique role name.

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Set up the XML string for the role in the business unit of the caller
   string strSecRoleXML = "<role>" +
      "<name>My New Custom Security Role</name>" +
      "<businessunitid>" + userAuth.MerchantId + "</businessunitid>" +
      "</role>";

   // Create and then retrieve the custom role
   string strNewRoleXml = secRole.CreateAndRetrieve(userAuth, strSecRoleXML);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Create
  • SecRole Class


SecRole.Delete Method

The Delete method deletes a role.

Syntax

[Visual Basic .NET]
Public Sub Delete(
  ByVal Caller As CUserAuth,
  ByVal RoleId As String
)
[C#]
public void Delete(
  CUserAuth  Caller,
  string  RoleId
);
[C++]
public: void Delete(
  CUserAuth*  Caller,
  String*  RoleId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvDeleteRole privilege to perform this action. See CUserAuth.
RoleId
Specifies the ID of the role to be deleted. This ID is specified by the platform and is obtained at creation time or by a bulk retrieve.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strSecRoleXML = "";
string strRoleId = "";
string strErrorMsg = "";

try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Set up the XML string for the role in the business unit of the caller
   strSecRoleXML = "<role>" +
      "<name>Custom Security Role</name>" +
      "<businessunitid>" + userAuth.MerchantId + "</businessunitid>" +
      "</role>";

   // The method returns the ID of the newly created role
   strRoleId = secRole.Create(userAuth, strSecRoleXML);

   // Now delete the new role
   secRole.Delete(userAuth, strRoleId);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • SecRole Class


SecRole.RemovePrivilege Method

The RemovePrivilege method removes a privilege from an existing role.

Syntax

[Visual Basic .NET]
Public Sub RemovePrivilege(
  ByVal Caller As CUserAuth,
  ByVal RoleId As String,
  ByVal PrivilegeId As String
)
[C#]
public void RemovePrivilege(
  CUserAuth  Caller,
  string  RoleId,
  string  PrivilegeId
);
[C++]
public: void RemovePrivilege(
  CUserAuth*  Caller,
  String*  RoleId,
  String*  PrivilegeId
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteRole privilege to perform this action. See CUserAuth.
RoleId
Specifies the ID of the role to which the privilege is being added. This ID is specified by the platform and is obtained at creation time or by a bulk retrieve.
PrivilegeId
Specifies the ID of the privilege that is being removed.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole   = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Privilege proxy object
Microsoft.Crm.Platform.Proxy.BizPrivilege privilege   = new Microsoft.Crm.Platform.Proxy.BizPrivilege ();
privilege.Credentials = System.Net.CredentialCache.DefaultCredentials;
privilege.Url = strDir + "BizPrivilege.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strSecRoleXML = "";
string strRoleId = "";
string strErrorMsg = "";

try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Set up the XML string for the role in the business unit of the caller
   strSecRoleXML = "<role>" +
      "<name>Custom Security Role</name>" +
      "<businessunitid>" + userAuth.MerchantId + "</businessunitid>" +
      "</role>";

   // The method returns the ID of the newly created role
   strRoleId = secRole.Create(userAuth, strSecRoleXML);

   // Create an array of privileges to add to the desired role
   Microsoft.Crm.Platform.Proxy.CRolePrivilege[] rolePrivileges = new Microsoft.Crm.Platform.Proxy.CRolePrivilege[2];
   for (int i=0;i<2;i++)
   {
      rolePrivileges[i] = new Microsoft.Crm.Platform.Proxy.CRolePrivilege();
   }

   // Retrieve all the privileges
   string strPrivilegeSet = privilege.RetrievePrivilegeSet(userAuth);

   // prvCreateAccount
   rolePrivileges[0].Depth = Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH.BASIC;
   rolePrivileges[0].PrivilegeId = "{D26FE964-230B-42DD-AD93-5CC879DE411E}";

   // prvReadAccount
   rolePrivileges[1].Depth = Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH.DEEP;
   rolePrivileges[1].PrivilegeId = "{886B280C-6396-4D56-A0A3-2C1B0A50CEB0}";

   // prvWriteAccount
   rolePrivileges[2].Depth = Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH.GLOBAL;
   rolePrivileges[2].PrivilegeId = "{7863E80F-0AB2-4D67-A641-37D9F342C7E3}";

   // Add some privileges to the role
   secRole.AddPrivileges(userAuth, strRoleId, rolePrivileges);

   // Now remove one of the priviliges from the new role
   // prvReadAccount
   secRole.RemovePrivilege(userAuth, strRoleId, "{886B280C-6396-4D56-A0A3-2C1B0A50CEB0}");
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • SecRole Class


SecRole.RemoveUserRoles Method

The RemoveUserRoles method removes an existing user from an existing role.

[Visual Basic .NET]
Public Sub RemoveUserRoles(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal RoleIds As String()
)
[C#]
public void RemoveUserRoles(
  CUserAuth  Caller,
  string  UserId,
  string[]  RoleIds
);
[C++]
public: void RemoveUserRoles(
  CUserAuth*  Caller,
  String*  UserId,
  String*  RoleIds __gc[]
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvAssignRole privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user being removed from the roles. This ID is specified by the platform and is obtained at user creation time or by a bulk retrieve.
RolesIds
Specifies an array of IDs for the roles from which the user is being removed. This is an array of strings, each of which contains one ID.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   string[] roles = new string[2];

   // Retrieve the role ID by name
   string strRoleId = secRole.RetrieveIdFromName(userAuth, userAuth.MerchantId, "Salesperson");
   string strRoleId1 = secRole.RetrieveIdFromName(userAuth, userAuth.MerchantId, "Sales Manager");
   if ((strRoleId != null) && (strRoleId1 != null))
   {
      roles[0] = strRoleId;
      roles[1] = strRoleId1;

      secRole.AssignUserRoles(userAuth, userAuth.UserId, roles);
   }

   // Now remove the roles
   secRole.RemoveUserRoles(userAuth, userAuth.UserId, roles);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • SecRole Class


SecRole.ReplacePrivileges Method

The ReplacePrivileges method replaces the privilege set of an existing role.

Syntax

[Visual Basic .NET]
Public Sub ReplacePrivileges(
  ByVal Caller As CUserAuth,
  ByVal RoleId As String,
  ByVal Privileges As CRolePrivilege()
)
[C#]
public void ReplacePrivileges(
  CUserAuth  Caller,
  string  RoleId,
  CRolePrivilege[]  Privileges
);
[C++]
public: void ReplacePrivileges(
  CUserAuth*  Caller,
  String*  RoleId,
  CRolePrivilege*  Privileges __gc[]
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvWriteRole privilege to perform this action. See CUserAuth.
RoleId
Specifies the ID of the role to which the privilege is being added. This ID is specified by the platform and is obtained at creation time or by a bulk retrieve.
Privileges
Specifies an array containing the IDs and depths of the privileges that are being added. Each CRolePrivilege structure should contain one string privilege ID. Privilege IDs can be obtained by a call to the BizPrivilege::RetrievePrivilegeSet method. See CRolePrivilege.

Return Value

No return value.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Privilege proxy object
Microsoft.Crm.Platform.Proxy.BizPrivilege privilege = new Microsoft.Crm.Platform.Proxy.BizPrivilege ();
privilege.Credentials = System.Net.CredentialCache.DefaultCredentials;
privilege.Url = strDir + "BizPrivilege.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strSecRoleXML = "";
string strErrorMsg = "";

try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Retrieve the desired role
   string strRoleId = secRole.RetrieveIdFromName(userAuth, userAuth.MerchantId, "My Role Name");

   // Retrieve all the privileges
   string strPrivilegeSet = privilege.RetrievePrivilegeSet(userAuth);

   // Create an array of privileges to add to the desired role
   Microsoft.Crm.Platform.Proxy.CRolePrivilege[] rolePrivileges = new Microsoft.Crm.Platform.Proxy.CRolePrivilege[2];
   for (int i=0;i<2;i++)
   {
      rolePrivileges[i] = new Microsoft.Crm.Platform.Proxy.CRolePrivilege();
   }

   // prvCreateAccount
   rolePrivileges[0].Depth = Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH.BASIC;
   rolePrivileges[0].PrivilegeId = "{D26FE964-230B-42DD-AD93-5CC879DE411E}";

   // prvReadAccount
   rolePrivileges[1].Depth = Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH.DEEP;
   rolePrivileges[1].PrivilegeId = "{886B280C-6396-4D56-A0A3-2C1B0A50CEB0}";

   // prvWriteAccount
   rolePrivileges[2].Depth = Microsoft.Crm.Platform.Proxy.PRIVILEGE_DEPTH.GLOBAL;
   rolePrivileges[2].PrivilegeId = "{7863E80F-0AB2-4D67-A641-37D9F342C7E3}";

   // Replace the privileges for the role
   secRole.ReplacePrivileges(userAuth, strRoleId, rolePrivileges);
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • SecRole Class


SecRole.Retrieve Method

The Retrieve method retrieves a role.

Syntax

[Visual Basic .NET]
Public Function Retrieve(
  ByVal Caller As CUserAuth,
  ByVal RoleId As String,
  ByVal ColumnSetXml As String
) As String
[C#]
public string Retrieve(
  CUserAuth  Caller,
  string  RoleId,
  string  ColumnSetXml
);
[C++]
public: String* Retrieve(
  CUserAuth*  Caller,
  String*  RoleId,
  String*  ColumnSetXml
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadRole privilege to perform this action. See CUserAuth.
RoleId
Specifies the ID of the role to retrieve. This ID is specified by the platform and is obtained at creation time or by a bulk retrieve.
ColumnSetXml
Specifies an XML string used to define the columns that are to be returned. Passing "" or null returns all columns. You can find the valid column names in role.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data describing the returned role. The XML schema is described by role.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strSecRoleXML;
string strRoleId;
string strErrorMsg;

try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Set up the XML string for the role in the business unit of the caller
   strSecRoleXML = "<role>" +
      "<name>Custom Security Role</name>" +
      "<businessunitid>" + userAuth.MerchantId + "</businessunitid>" +
      "</role>";

   // The method returns the ID of the newly created role
   strRoleId = secRole.Create(userAuth, strSecRoleXML);

   // Specify the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>roleid</column>";
   strColumnSetXml += "<column>businessunitid</column>";
   strColumnSetXml += "</columnset>";

   string strResultsXml = secRole.Retrieve(userAuth, strRoleId, strColumnSetXml);

}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • RetrieveAllRoles
  • RetrieveIdFromName
  • RetrieveRolePrivileges
  • RetrieveRoleUsers
  • RetrieveUserRoles
  • SecRole Class


SecRole.RetrieveAllRoles Method

The RetrieveAllRoles method retrieves all roles for the specified business unit.

Syntax

[Visual Basic .NET]
Public Function RetrieveAllRoles(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveAllRoles(
  CUserAuth  Caller,
  string  BusinessId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveAllRoles(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadRole privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit for which the roles are being retrieved. This ID is specified by the platform and is obtained at business unit creation time or by a bulk retrieve.
ColumnSetXML
Specifies an XML string used to define the columns that are to be returned. Passing "" or null returns all columns. You can find the valid column names in role.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data describing the roles that are returned. Only roles to which the caller has READ access are returned. This XML string is in the format

<roles> + role1..N + </roles>

where the XML schema for each role is described by role.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg  "";
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Specify the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>roleid</column>";
   strColumnSetXml += "<column>organizationid</column>";
   strColumnSetXml += "<column>businessunitid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve all roles for the caller's business unit
   string strRolesXml = secRole.RetrieveAllRoles(userAuth, userAuth.MerchantId, strColumnSetXml);

}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Retrieve
  • SecRole Class


SecRole.RetrieveIdFromName Method

The RetrieveIdFromName method retrieves the ID for the role with a specified name in a specified business unit.

Syntax

[Visual Basic .NET]
Public Function RetrieveIdFromName(
  ByVal Caller As CUserAuth,
  ByVal BusinessId As String,
  ByVal RoleName As String
) As String
[C#]
public string RetrieveIdFromName(
  CUserAuth  Caller,
  string  BusinessId,
  string  RoleName
);
[C++]
public: String* RetrieveIdFromName(
  CUserAuth*  Caller,
  String*  BusinessId,
  String*  RoleName
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadRole privilege to perform this action. See CUserAuth.
BusinessId
Specifies the ID of the business unit to which the role belongs. This ID is specified by the platform and is obtained at business unit creation time or by a bulk retrieve.
RoleName
Specifies the name of the role to retrieve.

Return Value

Returns a String type that specifies the ID of the specified role.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user   = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole   = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials      = System.Net.CredentialCache.DefaultCredentials;
secRole.Url            = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Retrieve the role ID by name
   string strRoleId = secRole.RetrieveIdFromName(userAuth, userAuth.MerchantId, "Custom Security Role");
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Retrieve
  • SecRole Class


SecRole.RetrieveRolePrivileges Method

The RetrieveRolePrivileges method retrieves the privileges that are assigned to the specified role.

Syntax

[Visual Basic .NET]
Public Function RetrieveRolePrivileges(
  ByVal Caller As CUserAuth,
  ByVal RoleId As String
) As CRolePrivilege()
[C#]
public CRolePrivilege[] RetrieveRolePrivileges(
  CUserAuth  Caller,
  string  RoleId
);
[C++]
public: CRolePrivilege* RetrieveRolePrivileges(
  CUserAuth*  Caller,
  String*  RoleId
)  __gc[];

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadRole privilege to perform this action. See CUserAuth.
RoleId
Specifies the ID of the role for which the privileges are being retrieved. This ID is specified by the platform and is obtained at creation time or by a bulk retrieve.

Return Value

Returns a CRolePrivilege[] type that specifies an array of structures containing the IDs and depths of the privileges held by the specified role. See CRolePrivilege.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;
try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Create an array of privileges to add to the desired role
   Microsoft.Crm.Platform.Proxy.CRolePrivilege[] rolePrivileges = new Microsoft.Crm.Platform.Proxy.CRolePrivilege[20];

   // Retrieve the role ID by name
   string strRoleId = secRole.RetrieveIdFromName(userAuth, userAuth.MerchantId, "Salesperson");
   if (strRoleId != null)
   {
      rolePrivileges = secRole.RetrieveRolePrivileges(userAuth, strRoleId);
   }
}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Retrieve
  • SecRole Class


SecRole.RetrieveRoleUsers Method

The RetrieveRoleUsers method retrieves the users that are assigned to the specified role.

Syntax

[Visual Basic .NET]
Public Function RetrieveRoleUsers(
  ByVal Caller As CUserAuth,
  ByVal RoleId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveRoleUsers(
  CUserAuth  Caller,
  string  RoleId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveRoleUsers(
  CUserAuth*  Caller,
  String*  RoleId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadRole privilege to perform this action. See CUserAuth.
RoleId
Specifies the ID of the role for which the users are being retrieved. This ID is specified by the platform and is obtained at creation time or by a bulk retrieve.
ColumnSetXML
Specifies an empty XML string used to define the columns that are to be returned. Passing "" or null returns all columns. You can find the valid column names in systemuser.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data describing the users that are returned. This XML string is in the format

<systemusers> + systemuser1..N + </systemusers>

where the XML schema for each user is described by systemuser.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;

try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Specify the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>fullname</column>";
   strColumnSetXml += "<column>systemuserid</column>";
   strColumnSetXml += "</columnset>";

   // Retrieve the role ID by name
   string strRoleId = secRole.RetrieveIdFromName(userAuth, userAuth.MerchantId, "System Administrator");
   string strUsersXml = "";
   if (strRoleId != null)
   {
      strUsersXml = secRole.RetrieveRoleUsers(userAuth, strRoleId, strColumnSetXml);
   }

}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

// This returns something similar to the following:
// " <SystemUsers> <SystemUser> <systemuserid>{F99C752E-49DD-40CF-9770-1BB919D6B4EF} </systemuserid> <firstname>Erin </firstname> </SystemUser> </SystemUsers>"

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Retrieve
  • SecRole Class


SecRole.RetrieveUserRoles Method

The RetrieveUserRoles method retrieves all roles for the specified user.

Syntax

[Visual Basic .NET]
Public Function RetrieveUserRoles(
  ByVal Caller As CUserAuth,
  ByVal UserId As String,
  ByVal ColumnSetXML As String
) As String
[C#]
public string RetrieveUserRoles(
  CUserAuth  Caller,
  string  UserId,
  string  ColumnSetXML
);
[C++]
public: String* RetrieveUserRoles(
  CUserAuth*  Caller,
  String*  UserId,
  String*  ColumnSetXML
);

Parameters

Caller
Specifies the identity of the caller. The caller must have the prvReadRole privilege to perform this action. See CUserAuth.
UserId
Specifies the ID of the user for which the roles are being retrieved. This ID is specified by the platform and is obtained at user creation time or by a bulk retrieve.
ColumnSetXML
Specifies an empty XML string used to define the columns that are to be returned. Passing "" or null returns all columns. You can find the valid column names in role.xsd. See also ColumnSetXML Schema.

Return Value

Returns a String type that specifies the XML data describing the roles that are returned. This XML string is in the format

<roles> + role1..N + </roles>

where the XML schema for each role is described by role.xsd.

Remarks

If there is an error, SOAP throws an exception and the error message is reported in System.Web.Services.Protocols.SoapException.Detail.OuterXml.

All IDs passed to the platform are GUIDs wrapped in braces. For example: {6522D89A-A752-4455-A2B0-51494C6957C3}

Example

[C#]
// strServer should be set with the name of the platform Web server
string strServer = "myservername";

// strVirtualDirectory should be set with the name of the Microsoft CRM
// virtual directory on the platform Web server
string strVirtualDirectory = "mscrmservices";

// Create the URL to the SRF files for platform objects
string strDir = "http://" + strServer + "/" + strVirtualDirectory + "/";

// BizUser proxy object
Microsoft.Crm.Platform.Proxy.BizUser user = new Microsoft.Crm.Platform.Proxy.BizUser ();
user.Credentials = System.Net.CredentialCache.DefaultCredentials;
user.Url = strDir + "BizUser.srf";

// SecRole proxy object
Microsoft.Crm.Platform.Proxy.SecRole secRole = new Microsoft.Crm.Platform.Proxy.SecRole ();
secRole.Credentials = System.Net.CredentialCache.DefaultCredentials;
secRole.Url = strDir + "SecRole.srf";

// Declare the caller
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = null;

string strErrorMsg;

try
{
   // Get the UserAuth of the current logged-on user
   userAuth = user.WhoAmI();

   // Specify the columns that you want to retrieve
   string strColumnSetXml = "<columnset>";
   strColumnSetXml += "<column>name</column>";
   strColumnSetXml += "<column>roleid</column>";
   strColumnSetXml += "<column>organizationid</column>";
   strColumnSetXml += "</columnset>";

   string strRolesXml = "";
   strRolesXml = secRole.RetrieveUserRoles(userAuth, userAuth.UserId, strColumnSetXml);

}
catch(System.Web.Services.Protocols.SoapException err)
{
   // Process the platform error here
   strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
}
catch(Exception err)
{
   // Process other errors here
   strErrorMsg = ("ErrorMessage: " + err.Message + "Source: " + err.Source );
}

//This method returns something similar to the following:
// " <roles> <role> <roleid>{C75FAB25-84A2-4C95-86D8-00161F7F087A} </roleid> <name>David Ortiz</name> </role> </roles>"

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Retrieve
  • SecRole Class


Microsoft.Crm.Platform.Proxy Enumerations

These enumerations are used as parameters to methods in the Microsoft CRM API. Do not use these enumerations when you are building XML strings. To build XML strings, use the enumerations in Microsoft.Crm.Platform.Types.

The following enumerations are included in the namespace Microsoft.Crm.Platform.Proxy.

Enumeration | Description
ACTIVITY_PARTY_TYPE | Lists activity party types.
ACTIVITY_STATE | Lists activity states.
ObjectType | Lists the set of possible object types.
PRIVILEGE_DEPTH | Lists privilege depths.
QUEUE_TYPE_CODE | Lists queue type codes.
ROUTE_TYPE_CODE | Lists route type codes.
SAVED_QUERY_TYPE | Lists saved query types.
SecurityPrincipalType | Contains a list of security principal types.
WORKFLOW_ERROR_SEVERITY | Lists workflow error severity.
WORKFLOW_PROCESS_TYPE | Lists workflow process types.


ACTIVITY_PARTY_TYPE Enumeration

The ACTIVITY_PARTY_TYPE enumeration type lists activity party types.

System.Object
   ACTIVITY_PARTY_TYPE
[Visual Basic .NET]
Public Class ACTIVITY_PARTY_TYPE
   Inherits System.Object
[C#]
public class ACTIVITY_PARTY_TYPE: System.Object
[C++]
public __gc class ACTIVITY_PARTY_TYPE: public System.Object

Members

ACTIVITY_PARTY_BCC_RECIPIENT
Specifies the recipient in the Bcc field.
ACTIVITY_PARTY_CC_RECIPIENT
Specifies the recipient in the Cc field.
ACTIVITY_PARTY_OPTIONALATTENDEE
Specifies an optional attendee.
ACTIVITY_PARTY_ORGANIZER
Specifies the activity organizer.
ACTIVITY_PARTY_OWNER
Specifies the activity owner. See Remarks.
ACTIVITY_PARTY_REGARDING
Specifies the regarding item. See Remarks.
ACTIVITY_PARTY_REQUIREDATTENDEE
Specifies a required attendee.
ACTIVITY_PARTY_SENDER
Specifies the sender.
ACTIVITY_PARTY_TO_RECIPIENT
Specifies the recipient in the To field.

Remarks

Parties of the type ACTIVITY_PARTY_OWNER and ACTIVITY_PARTY_REGARDING are read-only. The CRMActivity methods SetActivityParties, Create and Update ignore activity parties of these types.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Enumerations


ACTIVITY_STATE Enumeration

The ACTIVITY_STATE enumeration type lists activity states.

System.Object
   ACTIVITY_STATE
[Visual Basic .NET]
Public Class ACTIVITY_STATE
   Inherits System.Object
[C#]
public class ACTIVITY_STATE: System.Object
[C++]
public __gc class ACTIVITY_STATE: public System.Object

Members

ACTS_CANCELLED
Specifies that the activity was canceled.
ACTS_CLOSED
Specifies that the activity is closed.
ACTS_OPEN
Specifies that the activity is open.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Enumerations


ObjectType Enumeration

The ObjectType enumeration type describes the set of possible object types.

System.Object
   ObjectType
[Visual Basic .NET]
Public Class ObjectType
   Inherits System.Object
[C#]
public class ObjectType: System.Object
[C++]
public __gc class ObjectType: public System.Object

Members

otAccount
Specifies the Account object type.
otActivity
Specifies the Activity object type.
otActivityMimeAttachment
Specifies the ActivityMimeAttachment object type.
otActivityParty
Specifies the ActivityParty object type.
otAnnotation
Specifies the Annotation object type.
otAnnualFiscalCalendar
Specifies the AnnualFiscalCalendar object type.
otAppointmentActivity
Specifies the AppointmentActivity object type.
otBusinessUnit
Specifies the BusinessUnit object type.
otBusinessUnitNewsArticle
Specifies the BusinessUnitNewsArticle object type.
otChatActivity
Specifies the ChatActivity object type. [Not supported in this release.]
otCompetitor
Specifies the Competitor object type.
otCompetitorAddress
Specifies the CompetitorAddress object type.
otCompetitorContact
Specifies the CompetitorContact object type.
otCompetitorContactAddress
Specifies the CompetitorContactAddress object type.
otCompetitorRevenueReport
Specifies the CompetitorRevenueReport object type.
otContact
Specifies the Contact object type.
otContract
Specifies the Contract object type.
otContractDetail
Specifies the ContractDetail object type.
otContractTemplate
Specifies the ContractTemplate object type.
otCustomerAddress
Specifies the CustomerAddress object type.
otDiscount
Specifies the Discount object type.
otDiscountType
Specifies the DiscountType object type.
otDocumentIndex
Specifies the DocumentIndex object type.
otEmailActivity
Specifies the EmailActivity object type.
otExactDocumentMatch
Specifies the ExactDocumentMatch object type. [Not supported in this release.]
otFAQList
Specifies the FAQList object type. [Not supported in this release.]
otFaxActivity
Specifies the FaxActivity object type.
otFixedMonthlyFiscalCalendar
Specifies the FixedMonthlyFiscalCalendar object type.
otIncident
Specifies the Incident object type.
otIncidentEntryActivity
Specifies the IncidentEntryActivity object type.
otIncidentResolutionActivity
Specifies the IncidentResolutionActivity object type.
otIntegrationStatus
Specifies the IntegrationStatus object type.
otInternalAddress
Specifies the InternalAddress object type.
otInvoice
Specifies the Invoice object type.
otInvoiceDetail
Specifies the InvoiceDetail object type.
otKbArticle
Specifies the KbArticle object type.
otKbArticleComment
Specifies the KbArticleComment object type.
otKbArticleTemplate
Specifies the KbArticleTemplate object type.
otLWContact
Specifies the LWContact object type. [Not supported in this release.]
otLead
Specifies the Lead object type.
otLeadAddress
Specifies the LeadAddress object type.
otLetterActivity
Specifies the LetterActivity object type.
otLightweightContact
Specifies the LightweightContact object type. [Not supported in this release.]
otMailingList
Specifies the MailingList object type.
otMonthlyFiscalCalendar
Specifies the MonthlyFiscalCalendar object type.
otNone
Specifies no object type.
otOpportunity
Specifies the Opportunity object type.
otOpportunityCloseActivity
Specifies the OpportunityCloseActivity object type.
otOpportunityProduct
Specifies the OpportunityProduct object type.
otOrderCloseActivity
Specifies the orderCloseActivity object type.
otOrganization
Specifies the Organization object type.
otOrganizationUI
Specifies the OrganizationUI object type.
otPhoneCallActivity
Specifies the PhoneCallActivity object type.
otPriceLevel
Specifies the PriceLevel object type.
otPrivilege
Specifies the Privilege object type.
otProduct
Specifies the Product object type.
otProductPriceLevel
Specifies the ProductPriceLevel object type.
otQuarterlyFiscalCalendar
Specifies the QuarterlyFiscalCalendar object type.
otQueue
Specifies the Queue object type.
otQueueItem
Specifies the QueueItem object type.
otQuote
Specifies the Quote object type.
otQuoteCloseActivity
Specifies the QuoteCloseActivity object type.
otQuoteDetail
Specifies the QuoteDetail object type.
otRole
Specifies the Role object type.
otRoleTemplate
Specifies the RoleTemplate object type.
otSalesLiterature
Specifies the SalesLiterature object type.
otSalesLiteratureItem
Specifies the SalesLiteratureItem object type.
otSalesOrder
Specifies the SalesOrder object type.
otSalesOrderDetail
Specifies the SalesOrderDetail object type.
otSavedQuery
Specifies the SavedQuery object type.
otSavedQueryHeaders
Specifies the SavedQueryHeaders object type.
otSearchCriterion
Specifies the SearchCriterion object type. [Not supported in this release.]
otSearchLog
Specifies the SearchLog object type. [Not supported in this release.]
otSemiAnnualFiscalCalendar
Specifies the SemiAnnualFiscalCalendar object type.
otSubject
Specifies the Subject object type.
otSubscription
Specifies the Subscription object type.
otSuggestedExactMatch
Specifies the SuggestedExactMatch object type. [Not supported in this release.]
otSuggestedSearchCriterion
Specifies the SuggestedSearchCriterion object type. [Not supported in this release.]
otSyncEntry
Specifies the SyncEntry object type.
otSystemUser
Specifies the SystemUser object type.
otTeam
Specifies the Team object type.
otTemplate
Specifies the Template object type.
otTerritory
Specifies the Territory object type.
otTrackedItemHistory
Specifies the TrackedItemHistory object type.
otUnit
Specifies the Unit object type. [Not supported in this release.]
otUoM
Specifies the UoM (unit of measure) object type.
otUoMSchedule
Specifies the UoMSchedule (unit of measure schedule) object type.
otUserFiscalCalendar
Specifies the UserFiscalCalendar object type.
otUserSettings
Specifies the UserSettings object type.
otWFAction
Specifies the WFAction (workflow action) object type.
otWFActionLog
Specifies the WFActionLog (workflow action log) object type.
otWFCondition
Specifies the WFCondition (workflow condition) object type.
otWFEventLog
Specifies the WFEventLog (workflow event log) object type.
otWFParameter
Specifies the WFParameter (workflow parameter) object type.
otWFProcess
Specifies the WFProcess (workflow process) object type.
otWFProcessInstance
Specifies the WFProcessInstance (workflow process instance) object type.
otWFRule
Specifies the WFRule (workflow rule) object type.
otWFRuleLog
Specifies the WFRuleLog (workflow rule log) object type.
otWFStep
Specifies the WFStep (workflow step) object type.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Enumerations


PRIVILEGE_DEPTH Enumeration

The PRIVILEGE_DEPTH enumeration lists privilege depths.

System.Object
   PRIVILEGE_DEPTH
[Visual Basic .NET]
Public Class PRIVILEGE_DEPTH
   Inherits System.Object
[C#]
public class PRIVILEGE_DEPTH: System.Object
[C++]
public __gc class PRIVILEGE_DEPTH: public System.Object

Members

BASIC
Specifies basic privileges. Users with basic privileges can use privileges only to perform actions on data and objects that are owned by or assigned to the user.
DEEP
Specifies deep privileges. Users with deep privileges can perform actions on all objects in the user's current business units and all objects down the hierarchy of business units.
GLOBAL
Specifies global privileges. Users with global privileges can perform actions on data and objects anywhere within the organization, regardless of the business unit or user to which it belongs.
LOCAL
Specifies local privileges. Users with local privileges can use privileges only to perform actions on data and objects that are in the user's current business unit.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Enumerations


QUEUE_TYPE_CODE Enumeration

The QUEUE_TYPE_CODE enumeration type lists queue type codes.

System.Object
   QUEUE_TYPE_CODE
[Visual Basic .NET]
Public Class QUEUE_TYPE_CODE
   Inherits System.Object
[C#]
public class QUEUE_TYPE_CODE: System.Object
[C++]
public __gc class QUEUE_TYPE_CODE: public System.Object

Members

QTC_PRIVATE
Specifies a private queue.
QTC_PUBLIC
Specifies a public queue.
QTC_WIPBIN
Specifies a work-in-progress bin queue.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Enumerations


ROUTE_TYPE_CODE Enumeration

The ROUTE_TYPE_CODE enumeration type lists route type codes.

System.Object
   ROUTE_TYPE_CODE
[Visual Basic .NET]
Public Class ROUTE_TYPE_CODE
   Inherits System.Object
[C#]
public class ROUTE_TYPE_CODE: System.Object
[C++]
public __gc class ROUTE_TYPE_CODE: public System.Object

Members

RTC_AUTO
Specifies an automatic route.
RTC_QUEUE
Specifies to route to a public queue.
RTC_USER
Specifies to route to a user's private queue.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Enumerations


SAVED_QUERY_TYPE Enumeration

The SAVED_QUERY_TYPE enumeration type lists saved query types.

System.Object
   SAVED_QUERY_TYPE
[Visual Basic .NET]
Public Class SAVED_QUERY_TYPE
   Inherits System.Object
[C#]
public class SAVED_QUERY_TYPE: System.Object
[C++]
public __gc class SAVED_QUERY_TYPE: public System.Object

Members

ADVANCED_SEARCH
Specifies an advanced search.
MAIN_APPLICATION_VIEW
Specifies the main application view.
SUB_GRID
Specifies a sub-grid search.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Enumerations


SecurityPrincipalType Enumeration

The SecurityPrincipalType enumeration type contains a list of security principal types.

System.Object
   SecurityPrincipalType
[Visual Basic .NET]
Public Class SecurityPrincipalType
   Inherits System.Object
[C#]
public class SecurityPrincipalType: System.Object
[C++]
public __gc class SecurityPrincipalType: public System.Object

Members

sptMerchant
Specifies that the security principal is a merchant. [Not supported in this release.]
sptTeam
Specifies that the security principal is a team.
sptUser
Specifies that the security principal is a user.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Enumerations


WORKFLOW_ERROR_SEVERITY Enumeration

The WORKFLOW_ERROR_SEVERITY enumeration type lists values for workflow error severity. It is intended to be used in the out parameter CWorkflowErrorInfo from the call to CRMProcess.Activate.

System.Object
   WORKFLOW_ERROR_SEVERITY
[Visual Basic .NET]
Public Class WORKFLOW_ERROR_SEVERITY
   Inherits System.Object
[C#]
public class WORKFLOW_ERROR_SEVERITY: System.Object
[C++]
public __gc class WORKFLOW_ERROR_SEVERITY: public System.Object

Members

WFES_ERROR
There is a problem with the process that prevents activation.
WFES_MESSAGE
[Not used.]
WFES_WARNING
[Not used.]

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Enumerations


WORKFLOW_PROCESS_TYPE Enumeration

The WORKFLOW_PROCESS_TYPE enumeration type lists workflow process types.

System.Object
   WORKFLOW_PROCESS_TYPE
[Visual Basic .NET]
Public Class WORKFLOW_PROCESS_TYPE
   Inherits System.Object
[C#]
public class WORKFLOW_PROCESS_TYPE: System.Object
[C++]
public __gc class WORKFLOW_PROCESS_TYPE: public System.Object

Members

WFPT_NONE
Specifies no process.
WFPT_OBJECT_PROCESS
Specifies an object process.
WFPT_OBJECT_PROCESS_TEMPLATE
Specifies an object process template.
WFPT_PROCESS_TEMPLATE
Specifies a process template.
WFPT_WORKFLOW_PROCESS
Specifies a generic workflow process.
WFPT_WORKFLOW_PROCESS_TEMPLATE
Specifies a generic workflow process template.

Requirements

Namespace: Microsoft.Crm.Platform.Proxy

Assembly: Microsoft.Crm.Platform.Proxy.dll

See Also

  • Microsoft.Crm.Platform.Proxy Enumerations


Microsoft.Crm.Platform.Types

Most of the classes in this namespace do not need instantiation or initialization because the fields represent constant integer values. They are intended for use as values for fields within XML string parameters. Please note that although a method can accept any value, the values presented in this documentation are the valid values for these fields.

The following table lists the contents of the namespace Microsoft.Crm.Platform.Types.

Class | Description
AccessRights | Lists the possible access rights for a user.
ACCOUNT_STATE | Lists the account states.
ACTIVITY_PARTY_TYPE | Lists the activity party types.
ACTIVITY_STATE | Lists the activity states.
ACTIVITY_STATUS | Lists the activity status codes.
CALENDAR_TYPE_CODE | Lists the calendar types.
CascadeOps | Contains flags to support cascading operations.
CLONE_FIELD_TYPE | [Not supported in this release.]
CONTACT_STATE | Lists the contact states.
CONTRACT_ALLOTMENT_TYPE_CODE | Lists the possible contract allotment types.
CONTRACTDETAIL_STATE | Lists the contract detail states.
CONTRACT_STATE | Lists the contract states.
CUSTOMER_ADDRESS_TYPE | Lists the customer address types.
DeletionStateCode | Lists the object deletion states.
DISCOUNT_TYPE_STATE | Lists the discount type states.
EVENT_DIRECTION | Lists the event direction codes.
EVENT_TYPE | Lists the event types.
INCIDENT_STATE | Lists the incident (case) states.
InheritanceMask | Lists the values for inheritance for businesses.
INVOICE_STATE | Lists the invoice states.
KBARTICLE_STATE | Lists the knowledge base article states.
LEAD_STATE | Lists the lead states.
ObjectType | Lists the set of possible object types.
OPPORTUNITY_STATE | Lists the opportunity states.
PRICE_LEVEL_STATE | Lists the price level states.
PRICE_METHOD | Lists the price method states.
PRICING_ERROR_CODE | Lists the pricing error codes.
PRIORITY_CODE | Lists the possible priority codes.
PRIVILEGE_DEPTH | Lists the possible privilege level depths.
PRIVILEGE_DEPTH_MASK | [For internal use only.]
PRODUCT_STATE | Lists the possible product states.
QUANTITY_SELLING_CODE | Lists the possible values for quantity selling code.
QUEUE_TYPE_CODE | Lists the possible queue type codes.
QUOTE_STATE | Lists the possible quote states.
RESPONSE_CODE | Lists the direct e-mail response codes.
ROUNDING_OPTION | Lists the possible rounding options.
ROUNDING_POLICY | Lists the valid values for rounding policy.
ROUTE_TYPE_CODE | Lists the valid values for the route type code.
SALES_ORDER_STATE | Lists the sales order states.
SAVED_QUERY_TYPE | Lists the types of saved queries.
SecurityPrincipalType | Lists the possible types of security principals.
TASK_STATUS | Lists the possible status codes for tasks.
TRANSFORM_TARGET_FIELD_TYPE | Lists the valid values for the transformation target field type.
WORKFLOW_ACTION_TYPE | Lists the possible workflow action types.
WORKFLOW_DATA_TYPE | Lists the possible workflow data types.
WORKFLOW_ERROR_HANDLER_LEVEL | Lists the possible workflow error handler levels.
WORKFLOW_ERROR_SEVERITY | Lists the possible workflow error severities.
WORKFLOW_EVENT_TYPE | Lists the possible workflow event types.
WORKFLOW_PARAMETER_TYPE | Lists the possible workflow parameter types.
WORKFLOW_PROCESS_INSTANCE_EXIT_CODE | Lists the possible workflow process instance exit codes.
WORKFLOW_PROCESS_INSTANCE_STATE | Lists the possible workflow process instance states.
WORKFLOW_PROCESS_STATE | Lists the possible workflow process states.
WORKFLOW_PROCESS_TYPE | Lists the possible workflow process types.


AccessRights Class

The AccessRights class type describes the possible access rights for a user. Please note that although the APIs may accept any value, these are the valid values for access rights. To specify multiple values, use the OR operator as shown in the following example.

uint right = Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_READ | Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_WRITE | Microsoft.Crm.Platform.Types.AccessRights.CRM_ACCESS_SHARE;

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used as a parameter in the Microsoft CRM APIs.

System.Object
   AccessRights
[Visual Basic .NET]
Public Class AccessRights
   Inherits System.Object
[C#]
public class AccessRights: System.Object
[C++]
public __gc class AccessRights: public System.Object

The AccessRights class exposes the following integer fields.

Integer fields | Value | Description
CRM_ACCESS_ALL | CRM_ACCESS_READ | CRM_ACCESS_WRITE | CRM_ACCESS_DELETE | CRM_ACCESS_APPEND | CRM_ACCESS_ASSIGN | CRM_ACCESS_SHARE | CRM_ACCESS_CREATE | CRM_ACCESS_EXECUTE | CRM_ACCESS_APPENDTO | The union of all access rights.
CRM_ACCESS_APPEND | 0x00000004 | The right to append the specified object to another object.
CRM_ACCESS_APPENDTO | 0x00000010 | The right to append another object to the specified object.
CRM_ACCESS_ASSIGN | 0x00080000 | The right to assign the specified object to another security principal.
CRM_ACCESS_CREATE | 0x00000020 | The right to create an instance of the object type.
CRM_ACCESS_DELETE | 0x00010000 | The right to delete the specified object.
CRM_ACCESS_EXECUTE | 0x00000040 | The right to execute the specified query.
CRM_ACCESS_READ | 0x00000001 | The right to read the specified type of object.
CRM_ACCESS_SHARE | 0x00040000 | The right to share the specified object.
CRM_ACCESS_WRITE | 0x00000002 | The right to write (update) the specified object.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


ACCOUNT_STATE Class

The ACCOUNT_STATE class lists the possible account states, used for the account statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   ACCOUNT_STATE
[Visual Basic .NET]
Public Class ACCOUNT_STATE
   Inherits System.Object
[C#]
public class ACCOUNT_STATE: System.Object
[C++]
public __gc class ACCOUNT_STATE: public System.Object

The ACCOUNT_STATE class exposes the following integer fields.

Field | Value | Description
AS_ACTIVE | 0 | The account is active.
AS_INACTIVE | 1 | The account is inactive.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


ACTIVITY_PARTY_TYPE Class

The ACTIVITY_PARTY_TYPE class lists the possible activity party types, used for the activity party participationtypemask field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   ACTIVITY_PARTY_TYPE
[Visual Basic .NET]
Public Class ACTIVITY_PARTY_TYPE
   Inherits System.Object
[C#]
public class ACTIVITY_PARTY_TYPE: System.Object
[C++]
public __gc class ACTIVITY_PARTY_TYPE: public System.Object

The ACTIVITY_PARTY_TYPE class exposes the following integer fields.

Field | Value | Description
ACTIVITY_PARTY_BCC_RECIPIENT | 4 | The recipient in the Bcc field.
ACTIVITY_PARTY_CC_RECIPIENT | 3 | The recipient in the Cc field.
ACTIVITY_PARTY_OPTIONALATTENDEE | 6 | An optional attendee.
ACTIVITY_PARTY_ORGANIZER | 7 | The party organizer.
ACTIVITY_PARTY_OWNER | 9 | The party owner. See Remarks.
ACTIVITY_PARTY_REGARDING | 8 | The regarding item. See Remarks.
ACTIVITY_PARTY_REQUIREDATTENDEE | 5 | A required attendee.
ACTIVITY_PARTY_SENDER | 1 | The sender.
ACTIVITY_PARTY_TO_RECIPIENT | 2 | The recipient in the To field.

Remarks

Parties of the type ACTIVITY_PARTY_OWNER and ACTIVITY_PARTY_REGARDING are read-only. The following CRMActivity methods ignore activity parties of these types:

  • Create
  • CreateAndRetrieve
  • SetActivityParties
  • Update
  • UpdateAndRetrieve

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


ACTIVITY_STATE Class

The ACTIVITY_STATE class lists activity states, used for the activity statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   ACTIVITY_STATE
[Visual Basic .NET]
Public Class ACTIVITY_STATE
   Inherits System.Object
[C#]
public class ACTIVITY_STATE: System.Object
[C++]
public __gc class ACTIVITY_STATE: public System.Object

The ACTIVITY_STATE class exposes the following integer fields.

Field | Value | Description
ACTS_CANCELLED | 2 | The activity is canceled.
ACTS_CLOSED | 1 | The activity is closed.
ACTS_OPEN | 0 | The activity is open.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


ACTIVITY_STATUS Class

The ACTIVITY_STATUS class lists activity status codes, used for the activity statuscode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   ACTIVITY_STATUS
[Visual Basic .NET]
Public Class ACTIVITY_STATUS
   Inherits System.Object
[C#]
public class ACTIVITY_STATUS: System.Object
[C++]
public __gc class ACTIVITY_STATUS: public System.Object

The ACTIVITY_STATUS class exposes the following integer fields.

Field | Value | Description
ACTIVITY_STATUS_CANCELLED | 5 | The activity is canceled.
ACTIVITY_STATUS_COMPLETED | 3 | The activity is completed.
ACTIVITY_STATUS_INPROGRESS | 2 | The activity is in progress.
ACTIVITY_STATUS_PENDING | 1 | The activity is pending.
ACTIVITY_STATUS_SKIPPED | 4 | The activity was skipped.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


CALENDAR_TYPE_CODE Class

The CALENDAR_TYPE_CODE class type lists the possible calendar types. Please note that although the APIs may accept any value, these are the valid values for calendar type.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   CALENDAR_TYPE_CODE
[Visual Basic .NET]
Public Class CALENDAR_TYPE_CODE
   Inherits System.Object
[C#]
public class CALENDAR_TYPE_CODE: System.Object
[C++]
public __gc class CALENDAR_TYPE_CODE: public System.Object

The CALENDAR_TYPE_CODE class exposes the following integer fields.

Field | Value | Description
CTC_APPOINTMENT | 2 | Specifies an appointment.
CTC_MEETING | 1 | Specifies a meeting.
CTC_TASK | 0 | Specifies a task.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


CascadeOps Class

The CascadeOps class contains flags to support cascading operations. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   CascadeOps
[Visual Basic .NET]
Public Class CascadeOps
   Inherits System.Object
[C#]
public class CascadeOps: System.Object
[C++]
public __gc class CascadeOps: public System.Object

The CascadeOps class exposes the following integer fields.

Field | Value | Description
CASCADE_DEEP_ALL | 0x00000002 | Applies the operation through the entire hierarchy.
CASCADE_NONE | 0x00000000 | Do not cascade the operation.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


CONTACT_STATE Class

The CONTACT_STATE class lists the possible contact states, used for the contact statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   CONTACT_STATE
[Visual Basic .NET]
Public Class CONTACT_STATE
   Inherits System.Object
[C#]
public class CONTACT_STATE: System.Object
[C++]
public __gc class CONTACT_STATE: public System.Object

The CONTACT_STATE class exposes the following members.

Field | Value | Description
CS_ACTIVE | 0 | The contact is active.
CS_INACTIVE | 1 | The contact is inactive.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


CONTRACT_ALLOTMENT_TYPE_CODE Class

The CONTRACT_ALLOTMENT_TYPE_CODE class lists the possible contract allotment states, used for the contract allotmenttypecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   CONTRACT_ALLOTMENT_TYPE_CODE
[Visual Basic .NET]
Public Class CONTRACT_ALLOTMENT_TYPE_CODE
   Inherits System.Object
[C#]
public class CONTRACT_ALLOTMENT_TYPE_CODE: System.Object
[C++]
public __gc class CONTRACT_ALLOTMENT_TYPE_CODE: public System.Object

The CONTRACT_ALLOTMENT_TYPE_CODE class exposes the following integer fields.

Field | Value | Description
CTRATC_CASE | 1 | Allotment type case.
CTRATC_COVERAGE_DATES | 3 | Allotment type coverage dates.
CTRATC_TIME | 2 | Allotment type time.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


CONTRACT_STATE Class

The CONTRACT_STATE class lists the possible contract states, used for the contract statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   CONTRACT_STATE
[Visual Basic .NET]
Public Class CONTRACT_STATE
   Inherits System.Object
[C#]
public class CONTRACT_STATE: System.Object
[C++]
public __gc class CONTRACT_STATE: public System.Object

The CONTRACT_STATE class exposes the following integer fields.

Field | Value | Description
CTRST_ACTIVE | 2 | The contract is active.
CTRST_CANCEL | 4 | The contract has been canceled.
CTRST_DRAFT | 0 | The contract is a draft.
CTRST_EXPIRE | 5 | The contract is expired.
CTRST_HOLD | 3 | The contract is on hold.
CTRST_INVOICE | 1 | The contract has been invoiced.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


CONTRACTDETAIL_STATE Class

The CONTRACTDETAIL_STATE class lists contract detail states, used for the contract detail statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   CONTRACTDETAIL_STATE
[Visual Basic .NET]
Public Class CONTRACTDETAIL_STATE
   Inherits System.Object
[C#]
public class CONTRACTDETAIL_STATE: System.Object
[C++]
public __gc class CONTRACTDETAIL_STATE: public System.Object

The CONTRACTDETAIL_STATE class exposes the following integer fields.

Field | Value | Description
CTRDETST_CANCEL | 2 | The contract detail is canceled.
CTRDETST_EXPIRE | 3 | The contract detail is expired.
CTRDETST_NEW | 0 | A new contract detail.
CTRDETST_RENEW | 1 | The contract detail has been renewed.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


CUSTOMER_ADDRESS_TYPE Class

The CUSTOMER_ADDRESS_TYPE class lists the types of customer addresses, used for the addresstypecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   CUSTOMER_ADDRESS_TYPE
[Visual Basic .NET]
Public Class CUSTOMER_ADDRESS_TYPE
   Inherits System.Object
[C#]
public class CUSTOMER_ADDRESS_TYPE: System.Object
[C++]
public __gc class CUSTOMER_ADDRESS_TYPE: public System.Object

The CUSTOMER_ADDRESS_TYPE class exposes the following integer fields.

Field | Value | Description
CAT_ACCOUNT | 1 | The customer address is for an account.
CAT_CONTACT | 2 | The customer address is for a contact.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


DeletionStateCode Class

The DeletionStateCode class lists the object deletion status.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   DeletionStateCode
[Visual Basic .NET]
Public Class DeletionStateCode
   Inherits System.Object
[C#]
public class DeletionStateCode: System.Object
[C++]
public __gc class DeletionStateCode: public System.Object

The DeletionStateCode class exposes the following integer fields.

Field | Value | Description
dsActive | 0 | Specifies that the object is live in the database.
dsSoftDelete | 1 | [Not supported in this release.]
dsHardDelete | 2 | Specifies that the object is marked for removal on the next sweep.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


DISCOUNT_TYPE_STATE Class

The DISCOUNT_TYPE_STATE class lists the possible discount type states, used for the discount type statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   DISCOUNT_TYPE_STATE
[Visual Basic .NET]
Public Class DISCOUNT_TYPE_STATE
   Inherits System.Object
[C#]
public class DISCOUNT_TYPE_STATE: System.Object
[C++]
public __gc class DISCOUNT_TYPE_STATE: public System.Object

The DISCOUNT_TYPE_STATE class exposes the following integer fields.

Field | Value | Description
DTS_ACTIVE | 0 | The discount type is active.
DTS_INACTIVE | 1 | The discount type is inactive.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


EVENT_DIRECTION Class

The EVENT_DIRECTION class lists the possible event directions. Please note that although the APIs may accept any value, these are the valid values for event direction.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   EVENT_DIRECTION
[Visual Basic .NET]
Public Class EVENT_DIRECTION
   Inherits System.Object
[C#]
public class EVENT_DIRECTION: System.Object
[C++]
public __gc class EVENT_DIRECTION: public System.Object

The EVENT_DIRECTION class exposes the following integer fields.

Field | Value | Description
ED_INCOMING | 0 | Specifies an incoming event.
ED_INTERNAL | 2 | Specifies an internal event.
ED_OUTGOING | 1 | Specifies an outgoing event.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


EVENT_TYPE Class

The EVENT_TYPE class lists the possible event types. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   EVENT_TYPE
[Visual Basic .NET]
Public Class EVENT_TYPE
   Inherits System.Object
[C#]
public class EVENT_TYPE: System.Object
[C++]
public __gc class EVENT_TYPE: public System.Object

The EVENT_TYPE class exposes the following integer fields.

Field | Value | Description
ET_BULKEMAIL | 102 | Specifies a direct e-mail sent event.
ET_EMAIL | 100 | Specifies an e-mail sent event.
ET_EMAIL_RECEIVED | 101 | Specifies an e-mail received event.
ET_FAX | 105 | Specifies a received fax event.
ET_LETTER | 104 | Specifies a received letter event.
ET_MEETING | 106 | Specifies a meeting occurred event.
ET_PHONE | 103 | Specifies a received phone call event.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


INCIDENT_STATE Class

The INCIDENT_STATE class lists the possible incident (case) states, used for the incident statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   INCIDENT_STATE
[Visual Basic .NET]
Public Class INCIDENT_STATE
   Inherits System.Object
[C#]
public class INCIDENT_STATE: System.Object
[C++]
public __gc class INCIDENT_STATE: public System.Object

The INCIDENT_STATE class exposes the following integer fields.

Field | Value | Description
IS_CANCELLED | 2 | Specifies the incident (case) is canceled.
IS_CLOSED | 1 | Specifies the incident (case) is closed. Note The Microsoft CRM application uses Resolved in the user interface for this state.
IS_OPEN | 0 | Specifies the incident (case) is open.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


InheritanceMask Class

The InheritanceMask class lists the values for inheritance for businesses. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   InheritanceMask
[Visual Basic .NET]
Public Class InheritanceMask
   Inherits System.Object
[C#]
public class InheritanceMask: System.Object
[C++]
public __gc class InheritanceMask: public System.Object

The InheritanceMask class exposes the following integer fields.

Field | Value | Description
BIZ_INHERIT_ALL | BIZ_INHERIT_PROCESSTEMPLATE | BIZ_INHERIT_EMAILTEMPLATE | BIZ_INHERIT_REFERRALSOURCE | BIZ_INHERIT_COMPETITOR | BIZ_INHERIT_SALESPROCESS | BIZ_MUST_INHERIT_PROCESSTEMPLATE | BIZ_MUST_INHERIT_EMAILTEMPLATE | BIZ_MUST_INHERIT_REFERRALSOURCE | BIZ_MUST_INHERIT_COMPETITOR | BIZ_MUST_INHERIT_SALESPROCESS | Sets the flags for all of the inheritance values.
BIZ_INHERIT_COMPETITOR | 0x0000008 | Business inherits competitors from parent business.
BIZ_INHERIT_EMAILTEMPLATE | 0x00000002 | Business inherits e-mail templates from parent business.
BIZ_INHERIT_NONE | 0x00000000 | Does not inherit from parent business.
BIZ_INHERIT_PROCESSTEMPLATE | 0x00000001 | Child business units must inherit process templates from this business.
BIZ_INHERIT_REFERRALSOURCE | 0x00000004 | Child business units must inherit referral sources from this business.
BIZ_INHERIT_SALESPROCESS | 0x00000010 | Business inherits sale processes from parent business.
BIZ_MUST_INHERIT_COMPETITOR | 0x00000100 | Business inherits competitors from parent business.
BIZ_MUST_INHERIT_EMAILTEMPLATE | 0x0000040 | Child business units must inherit e-mail templates from this business.
BIZ_MUST_INHERIT_PROCESSTEMPLATE | x00000020 | Business inherits process templates from parent business.
BIZ_MUST_INHERIT_REFERRALSOURCE | 0x0000080 | Child business units must inherit referral sources from this business.
BIZ_MUST_INHERIT_SALESPROCESS | 0x00000200 | Business inherits sale processes from parent business.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


INVOICE_STATE Class

The INVOICE_STATE class lists invoice states, used for the invoice statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   INVOICE_STATE
[Visual Basic .NET]
Public Class INVOICE_STATE
   Inherits System.Object
[C#]
public class INVOICE_STATE: System.Object
[C++]
public __gc class INVOICE_STATE: public System.Object

The INVOICE_STATE class exposes the following integer fields.

Field | Value | Description
INS_ACTIVE | 0 | The invoice is active.
INS_CLOSED | 1 | The invoice is closed.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


KBARTICLE_STATE Class

The KBARTICLE_STATE class lists knowledge base article states, used for the Knowledge Base article statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   KBARTICLE_STATE
[Visual Basic .NET]
Public Class KBARTICLE_STATE
   Inherits System.Object
[C#]
public class KBARTICLE_STATE: System.Object
[C++]
public __gc class KBARTICLE_STATE: public System.Object

The KBARTICLE_STATE class exposes the following integer fields.

Field | Value | Description
KBAS_DRAFT | 1 | Specifies the knowledge base article is a draft.
KBAS_PUBLISHED | 3 | Specifies the knowledge base article has been published.
KBAS_WAITING_APPROVAL | 2 | Specifies the knowledge base article is waiting approval.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


LEAD_STATE Class

The LEAD_STATE class lists lead states, used for the lead statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   LEAD_STATE
[Visual Basic .NET]
Public Class LEAD_STATE
   Inherits System.Object
[C#]
public class LEAD_STATE: System.Object
[C++]
public __gc class LEAD_STATE: public System.Object

The LEAD_STATE class exposes the following integer fields.

Field | Value | Description
LS_DISQUALIFIED | 2 | The lead is disqualified.
LS_OPEN | 0 | The lead is open.
LS_QUALIFIED | 1 | The lead is qualified.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


ObjectType Class

The ObjectType class type describes the set of possible object types. Please note that although the APIs may accept any value, these are the valid values for object type.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   ObjectType
[Visual Basic .NET]
Public Class ObjectType
   Inherits System.Object
[C#]
public class ObjectType: System.Object
[C++]
public __gc class ObjectType: public System.Object

The ObjectType class exposes the following integer fields.

Field | Value | Description
otAccount | 1 | Specifies an account object.
otActivity | 134 | Specifies an activity object.
otActivityMimeAttachment | 1001 | Specifies an activity MIME attachment object.
otActivityParty | 135 | Specifies an activity party object.
otAnnotation | 5 | Specifies an annotation (note) object.
otAnnualFiscalCalendar | 2000 | Specifies an annual fiscal calendar object.
otAppointmentActivity | 142 | Specifies an appointment activity object.
otBusinessUnit | 10 | Specifies a business unit object.
otBusinessUnitNewsArticle | 132 | Specifies a business unit new article object.
otChatActivity | 139 | Specifies a chat activity object. [Not supported in this release.]
otCompetitor | 123 | Specifies a competitor object.
otCompetitorAddress | 1004 | Specifies a competitor address object.
otCompetitorContact | 130 | Specifies a competitor contact object.
otCompetitorContactAddress | 1005 | Specifies a competitor contact address object.
otCompetitorRevenueReport | 1007 | Specifies a competitor revenue object.
otContact | 2 | Specifies a contact object.
otContract | 1010 | Specifies a contract object.
otContractDetail | 1011 | Specifies a contract detail object.
otContractTemplate | 2011 | Specifies a contract template object.
otCustomerAddress | 1071 | Specifies a customer address object.
otDiscount | 1013 | Specifies a discount object.
otDiscountType | 1080 | Specifies a discount type object.
otDocumentIndex | 126 | Specifies a document index object.
otEmailActivity | 138 | Specifies an e-mail activity object.
otExactDocumentMatch | 1014 | Specifies an exact document match object. [Not supported in this release.]
otFAQList | 128 | Specifies a FAQ List object. [Not supported in this release.]
otFaxActivity | 136 | Specifies a fax activity object.
otFixedMonthlyFiscalCalendar | 2004 | Specifies a fixed monthly fiscal calendar object.
otIncident | 112 | Specifies an incident object.
otIncidentEntryActivity | 1081 | Specifies an incident entry activity object.
otIncidentResolutionActivity | 140 | Specifies an incident resolution activity object.
otIntegrationStatus | 3000 | Specifies an integration status object.
otInternalAddress | 1003 | Specifies an internal address object.
otInvoice | 1090 | Specifies an invoice object.
otInvoiceDetail | 1091 | Specifies an invoice detail object.
otKbArticle | 127 | Specifies a knowledge base article object.
otKbArticleComment | 1082 | Specifies a knowledge base article comment object.
otKbArticleTemplate | 1016 | Specifies a knowledge base article template object.
otLead | 4 | Specifies a lead object.
otLeadAddress | 1017 | Specifies a lead address object.
otLetterActivity | 141 | Specifies a letter activity object.
otLightweightContact | 131 | Specifies a lightweight contact object. [Not supported in this release.]
otLWContact | 2012 | Specifies a lightweight contact object. [Not supported in this release.]
otMailingList | 2014 | Specifies a mailing list object.
otMonthlyFiscalCalendar | 2003 | Specifies a monthly fiscal calendar object.
otNone | 0 | Specifies no object.
otOpportunity | 3 | Specifies an opportunity object.
otOpportunityCloseActivity | 145 | Specifies an opportunity close activity object.
otOpportunityProduct | 1083 | Specifies an opportunity product object.
otOrderCloseActivity | 147 | Specifies an order close activity object.
otOrganization | 1019 | Specifies an organization object.
otOrganizationUI | 1021 | Specifies an organization UI object.
otPhoneCallActivity | 137 | Specifies a phone call activity object.
otPriceLevel | 1022 | Specifies a price level object.
otPrivilege | 1023 | Specifies a privilege object.
otProduct | 1024 | Specifies a product object.
otProductPriceLevel | 1026 | Specifies a product price level object.
otQuarterlyFiscalCalendar | 2002 | Specifies a quarterly fiscal calendar object.
otQueue | 2020 | Specifies a queue object.
otQueueItem | 2029 | Specifies a queue item object.
otQuote | 1084 | Specifies a quote object.
otQuoteCloseActivity | 146 | Specifies a quote close activity object.
otQuoteDetail | 1085 | Specifies a quote detail object.
otRole | 1036 | Specifies a role object.
otRoleTemplate | 1037 | Specifies a role template object.
otSalesLiterature | 1038 | Specifies a sales literature object.
otSalesLiteratureItem | 1070 | Specifies a sales literature item object.
otSalesOrder | 1088 | Specifies a sales order object.
otSalesOrderDetail | 1089 | Specifies a sales order detail object.
otSavedQuery | 1039 | Specifies a saved query object.
otSavedQueryHeaders | 0 | Specifies a saved query headers object.
otSearchCriterion | 1040 | Specifies a search criterion object. [Not supported in this release.]
otSearchLog | 1041 | Specifies a search log object. [Not supported in this release.]
otSemiAnnualFiscalCalendar | 2001 | Specifies a semi-annual fiscal calendar object.
otSubject | 129 | Specifies a subject object.
otSubscription | 0 | Specifies a subscription object.
otSuggestedExactMatch | 1044 | Specifies a suggested exact match object. [Not supported in this release.]
otSuggestedSearchCriterion | 1045 | Specifies a suggested search criterion object. [Not supported in this release.]
otSyncEntry | 0 | Specifies a sync entry object.
otSystemUser | 8 | Specifies a system user object.
otTeam | 9 | Specifies a team object.
otTemplate | 2010 | Specifies a template object.
otTerritory | 2013 | Specifies a territory object.
otTrackedItemHistory | 2028 | Specifies a tracked item history object.
otUnit | 1054 | Specifies a unit object. [Not supported in this release.]
otUoM | 1055 | Specifies a unit of measure object.
otUoMSchedule | 1056 | Specifies a unit of measure schedule object.
otUserFiscalCalendar | 1086 | Specifies a user fiscal calendar object.
otUserSettings | 150 | Specifies a user settings object.
otWFAction | 1061 | Specifies a workflow action object.
otWFActionLog | 1062 | Specifies a workflow action log object.
otWFCondition | 1064 | Specifies a workflow condition object.
otWFEventLog | 1065 | Specifies a workflow event log object.
otWFParameter | 1066 | Specifies a workflow parameter object.
otWFProcess | 121 | Specifies a workflow process object.
otWFProcessInstance | 122 | Specifies a workflow process instance object.
otWFRule | 1067 | Specifies a workflow rule object.
otWFRuleLog | 1068 | Specifies a workflow rule log object.
otWFStep | 1069 | Specifies a workflow step object.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


OPPORTUNITY_STATE Class

The OPPORTUNITY_STATE class lists opportunity states, used for the opportunity statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   OPPORTUNITY_STATE
[Visual Basic .NET]
Public Class OPPORTUNITY_STATE
   Inherits System.Object
[C#]
public class OPPORTUNITY_STATE: System.Object
[C++]
public __gc class OPPORTUNITY_STATE: public System.Object

The OPPORTUNITY_STATE class exposes the following integer fields.

Field | Value | Description
OS_LOST | 2 | The opportunity was lost.
OS_OPEN | 0 | The opportunity is open.
OS_WON | 1 | The opportunity was won.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


PRICE_LEVEL_STATE Class

The PRICE_LEVEL_STATE class lists price level states, used for the price level statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   PRICE_LEVEL_STATE
[Visual Basic .NET]
Public Class PRICE_LEVEL_STATE
   Inherits System.Object
[C#]
public class PRICE_LEVEL_STATE: System.Object
[C++]
public __gc class PRICE_LEVEL_STATE: public System.Object

The PRICE_LEVEL_STATE class exposes the following integer fields.

Field | Value | Description
PLS_ACTIVE | 0 | The price level is active.
PLS_INACTIVE | 1 | The price level is inactive.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


PRICE_METHOD Class

The PRICE_METHOD class lists pricing method values. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   PRICE_METHOD
[Visual Basic .NET]
Public Class PRICE_METHOD
   Inherits System.Object
[C#]
public class PRICE_METHOD: System.Object
[C++]
public __gc class PRICE_METHOD: public System.Object

The PRICE_METHOD class exposes the following integer fields.

Field | Value | Description
PM_CURRENCY_AMOUNT | 1 | Specifies the currency amount.
PM_MARGIN_CURRENT_COST | 4 | Specifies the percent margin - current cost.
PM_MARGIN_STANDARD_COST | 6 | Specifies the percent margin - standard cost.
PM_MARKUP_CURRENT_COST | 3 | Specifies the percent markup – current cost.
PM_MARKUP_STANDARD_COST | 5 | Specifies the percent markup - standard cost.
PM_PERCENT_LIST_PRICE | 2 | Specifies the percent of list price.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy
  • Pricing Methods


PRICING_ERROR_CODE Class

The PRICING_ERROR_CODE class lists pricing error codes. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   PRICING_ERROR_CODE
[Visual Basic .NET]
Public Class PRICING_ERROR_CODE
   Inherits System.Object
[C#]
public class PRICING_ERROR_CODE: System.Object
[C++]
public __gc class PRICING_ERROR_CODE: public System.Object

The PRICING_ERROR_CODE class exposes the following integer fields.

Field | Value | Description
PEC_DETAIL_ERROR | 1 | Specifies that an error occurred while pricing a detail line item.
PEC_DISCOUNT_TYPE_INVALID_STATE | 27 | Specifies the discount type has an invalid state.
PEC_INACTIVE_PRICE_LEVEL | 3 | Specifies an inactive price level.
PEC_INVALID_CURRENT_COST | 20 | Specifies an invalid current cost.
PEC_INVALID_DISCOUNT | 28 | Specifies an invalid discount.
PEC_INVALID_DISCOUNT_TYPE | 26 | Specifies an invalid discount type.
PEC_INVALID_PRICE | 19 | Specifies an invalid price.
PEC_INVALID_PRICE_LEVEL_AMOUNT | 17 | Specifies an invalid price level amount.
PEC_INVALID_PRICE_LEVEL_PERCENTAGE | 18 | Specifies an invalid price level percentage.
PEC_INVALID_PRICING_CODE | 9 | Specifies an invalid pricing method code.
PEC_INVALID_PRICING_PRECISION | 30 | Specifies an invalid pricing precision.
PEC_INVALID_PRODUCT | 7 | Specifies an invalid product.
PEC_INVALID_QUANTITY | 29 | Specifies an invalid quantity.
PEC_INVALID_ROUNDING_AMOUNT | 24 | Specifies an invalid rounding amount.
PEC_INVALID_ROUNDING_OPTION | 23 | Specifies an invalid rounding option.
PEC_INVALID_ROUNDING_POLICY | 22 | Specifies an invalid rounding policy.
PEC_INVALID_STANDARD_COST | 21 | Specifies an invalid standard cost.
PEC_MISSING_CURRENT_COST | 15 | Specifies a missing current cost.
PEC_MISSING_PRICE | 14 | Specifies a missing price.
PEC_MISSING_PRICE_LEVEL | 2 | Specifies a missing price level.
PEC_MISSING_PRICE_LEVEL_AMOUNT | 12 | Specifies a missing price level amount.
PEC_MISSING_PRICE_LEVEL_PERCENTAGE | 13 | Specifies a missing price level percentage.
PEC_MISSING_PRICING_CODE | 8 | Specifies a missing pricing method code.
PEC_MISSING_PRODUCT | 6 | Specifies a missing product.
PEC_MISSING_PRODUCT_DEFAULTUOM | 31 | Specifies a missing product default unit of measure.
PEC_MISSING_PRODUCT_UOMSCHEDULE | 32 | Specifies a missing product default unit of measure schedule.
PEC_MISSING_QUANTITY | 4 | Specifies a missing quantity.
PEC_MISSING_STANDARD_COST | 16 | Specifies a missing standard cost.
PEC_MISSING_UNIT_PRICE | 5 | Specifies a missing unit price
PEC_MISSING_UOM | 10 | Specifies a missing unit of measure.
PEC_NONE | 0 | Specifies no error.
PEC_PRICE_CALCULATION_ERROR | 25 | Specifies that an error occurred during price calculation.
PEC_PRODUCT_NOT_IN_PRICE_LEVEL | 11 | Specifies that the product is not in the price level.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


PRIORITY_CODE Class

The PRIORITY_CODE class lists the possible priority codes. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   PRIORITY_CODE
[Visual Basic .NET]
Public Class PRIORITY_CODE
   Inherits System.Object
[C#]
public class PRIORITY_CODE: System.Object
[C++]
public __gc class PRIORITY_CODE: public System.Object

The PRIORITY_CODE class exposes the following integer fields.

Field | Value | Description
PC_HIGH | 2 | High priority.
PC_LOW | 0 | Low priority.
PC_MEDIUM | 1 | Medium priority.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


PRIVILEGE_DEPTH Class

The PRIVILEGE_DEPTH class lists the possible privilege level depths. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   PRIVILEGE_DEPTH
[Visual Basic .NET]
Public Class PRIVILEGE_DEPTH
   Inherits System.Object
[C#]
public class PRIVILEGE_DEPTH: System.Object
[C++]
public __gc class PRIVILEGE_DEPTH: public System.Object

The PRIVILEGE_DEPTH class exposes the following members.

Field | Value | Description
BASIC | 0 | Specifies basic privileges. Users with basic privileges can only use privileges to perform actions on objects that are owned by or objects shared with the user.
LOCAL | 1 | Specifies local privileges. Users with local privileges can only use privileges to perform actions on data and objects that are in the user's current business unit.
DEEP | 2 | Specifies deep privileges. Users with deep privileges can perform actions on all objects in the user's current business units and all objects down the hierarchy of business units.
GLOBAL | 3 | Specifies global privileges. Users with global privileges can perform actions on data and objects anywhere within the organization, regardless of the business unit or user to which it belongs.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


PRODUCT_STATE Class

The PRODUCT_STATE class lists possible product states, used for the product statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   PRODUCT_STATE
[Visual Basic .NET]
Public Class PRODUCT_STATE
   Inherits System.Object
[C#]
public class PRODUCT_STATE: System.Object
[C++]
public __gc class PRODUCT_STATE: public System.Object

The PRODUCT_STATE class exposes the following integer fields.

Field | Value | Description
PS_ACTIVE | 0 | The product is active.
PS_INACTIVE | 1 | The product is inactive.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


QUANTITY_SELLING_CODE Class

The QUANTITY_SELLING_CODE class lists possible values for quantity selling code. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   QUANTITY_SELLING_CODE
[Visual Basic .NET]
Public Class QUANTITY_SELLING_CODE
   Inherits System.Object
[C#]
public class QUANTITY_SELLING_CODE: System.Object
[C++]
public __gc class QUANTITY_SELLING_CODE: public System.Object

The QUANTITY_SELLING_CODE class exposes the following integer fields.

Field | Value | Description
QSC_NO_CONTROL | 1 | Specifies no control.
QSC_WHOLE | 2 | Specifies whole.
QSC_WHOLE_AND_FRACTION | 3 | Specifies whole and fraction.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


QUEUE_TYPE_CODE Class

The QUEUE_TYPE_CODE class lists possible queue type codes, used for the queue queuetypecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   QUEUE_TYPE_CODE
[Visual Basic .NET]
Public Class QUEUE_TYPE_CODE
   Inherits System.Object
[C#]
public class QUEUE_TYPE_CODE: System.Object
[C++]
public __gc class QUEUE_TYPE_CODE: public System.Object

The QUEUE_TYPE_CODE class exposes the following integer fields.

Field | Value | Description
QTC_PRIVATE | 2 | The queue type is private.
QTC_PUBLIC | 1 | The queue type is public.
QTC_WIPBIN | 3 | The queue type is the work-in-progress bin.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


QUOTE_STATE Class

The QUOTE_STATE class is used to describe quote states, used for the quote statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   QUOTE_STATE
[Visual Basic .NET]
Public Class QUOTE_STATE
   Inherits System.Object
[C#]
public class QUOTE_STATE: System.Object
[C++]
public __gc class QUOTE_STATE: public System.Object

The QUOTE_STATE class exposes the following integer fields.

Field | Value | Description
QS_ACTIVE | 1 | The quote is active.
QS_CLOSED | 3 | The quote is closed
QS_DRAFT | 0 | The quote is a draft.
QS_WON | 2 | The quote has been won.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


RESPONSE_CODE Class

The RESPONSE_CODE class is lists direct e-mail response codes. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   RESPONSE_CODE
[Visual Basic .NET]
Public Class RESPONSE_CODE
   Inherits System.Object
[C#]
public class RESPONSE_CODE: System.Object
[C++]
public __gc class RESPONSE_CODE: public System.Object

The RESPONSE_CODE class exposes the following integer fields.

Field | Value | Description
RC_INFO | 1 | Specifies that the respondent needs more information.
RC_INTERESTED | 2 | Specifies that the respondent is interested.
RC_UNSUBSCRIBE | 0 | Specifies that the respondent wants to unsubscribe.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


ROUNDING_OPTION Class

The ROUNDING_OPTION class lists the possible rounding options. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   ROUNDING_OPTION
[Visual Basic .NET]
Public Class ROUNDING_OPTION
   Inherits System.Object
[C#]
public class ROUNDING_OPTION: System.Object
[C++]
public __gc class ROUNDING_OPTION: public System.Object

The ROUNDING_OPTION class exposes the following integer fields.

Field | Value | Description
RO_ENDS_IN | 1 | Specifies ends in.
RO_MULTIPLE_OF | 2 | Specifies multiple of.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


ROUNDING_POLICY Class

The ROUNDING_POLICY class lists the valid values for rounding policy. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   ROUNDING_POLICY
[Visual Basic .NET]
Public Class ROUNDING_POLICY
   Inherits System.Object
[C#]
public class ROUNDING_POLICY: System.Object
[C++]
public __gc class ROUNDING_POLICY: public System.Object

The ROUNDING_POLICY class exposes the following integer fields.

Field | Value | Description
RP_DOWN | 3 | Specifies to round down.
RP_NEAREST | 4 | Specifies to round to the nearest value.
RP_NONE | 1 | Specifies to do no rounding.
RP_UP | 2 | Specifies to round up.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


ROUTE_TYPE_CODE Class

The ROUTE_TYPE_CODE class lists the valid values for the route type code. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   ROUTE_TYPE_CODE
[Visual Basic .NET]
Public Class ROUTE_TYPE_CODE
   Inherits System.Object
[C#]
public class ROUTE_TYPE_CODE: System.Object
[C++]
public __gc class ROUTE_TYPE_CODE: public System.Object

The ROUTE_TYPE_CODE class exposes the following integer fields.

Field | Value | Description
RTC_AUTO | 1 | Specifies an automatic route.
RTC_QUEUE | 3 | Specifies to route to a public queue.
RTC_USER | 2 | Specifies to route to user's private queue.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


SALES_ORDER_STATE Class

The SALES_ORDER_STATE class lists sales order states, used for the sales order statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   SALES_ORDER_STATE
[Visual Basic .NET]
Public Class SALES_ORDER_STATE
   Inherits System.Object
[C#]
public class SALES_ORDER_STATE: System.Object
[C++]
public __gc class SALES_ORDER_STATE: public System.Object

The SALES_ORDER_STATE class exposes the following integer fields.

Field | Value | Description
SOS_ACTIVE | 0 | Specifies the sales order is active.
SOS_CANCELLED | 2 | Specifies the sales order has been canceled.
SOS_SUBMITTED | 1 | Specifies the sales order has been submitted.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


SAVED_QUERY_TYPE Class

The SAVED_QUERY_TYPE class lists the types of saved queries. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   SAVED_QUERY_TYPE
[Visual Basic .NET]
Public Class SAVED_QUERY_TYPE
   Inherits System.Object
[C#]
public class SAVED_QUERY_TYPE: System.Object
[C++]
public __gc class SAVED_QUERY_TYPE: public System.Object

The SAVED_QUERY_TYPE class exposes the following integer fields.

Field | Value | Description
ADVANCED_SEARCH | 1 | Specifies an advanced search.
MAIN_APPLICATION_VIEW | 0 | Specifies the main application view.
SUB_GRID | 2 | Specifies a sub-grid.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


SecurityPrincipalType Class

The SecurityPrincipalType class lists the possible types of security principals. Please note that although the APIs may accept any value, these are the valid values for security principal type.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   SecurityPrincipalType
[Visual Basic .NET]
Public Class SecurityPrincipalType
   Inherits System.Object
[C#]
public class SecurityPrincipalType: System.Object
[C++]
public __gc class SecurityPrincipalType: public System.Object

The SecurityPrincipalType class exposes the following integer fields.

Field | Value | Description
sptMerchant | 1 | Specifies that the security principal is a business. [Not supported in this release.]
sptTeam | 2 | Specifies that the security principal is a team.
sptUser | 0 | Specifies that the security principal is a user.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


TASK_STATUS Class

The TASK_STATUS class lists possible status codes for tasks. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   TASK_STATUS
[Visual Basic .NET]
Public Class TASK_STATUS
   Inherits System.Object
[C#]
public class TASK_STATUS: System.Object
[C++]
public __gc class TASK_STATUS: public System.Object

The TASK_STATUS class exposes the following integer fields.

Field | Value | Description
TS_ABORTED | 5 | Specifies that the task aborted.
TS_COMPLETED | 4 | Specifies that the task has completed.
TS_INPROGRESS | 3 | Specifies that the task is in progress.
TS_NOTSTARTED | 1 | Specifies that the task has not yet started.
TS_NULL | 0 | Specifies an invalid task status.
TS_STARTED | 2 | Specifies that the task has been started.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy


TRANSFORM_TARGET_FIELD_TYPE Class

The TRANSFORM_TARGET_FIELD_TYPE class lists the valid values for transformation target field type. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   TRANSFORM_TARGET_FIELD_TYPE
[Visual Basic .NET]
Public Class TRANSFORM_TARGET_FIELD_TYPE
   Inherits System.Object
[C#]
public class TRANSFORM_TARGET_FIELD_TYPE: System.Object
[C++]
public __gc class TRANSFORM_TARGET_FIELD_TYPE: public System.Object

The TRANSFORM_TARGET_FIELD_TYPE class exposes the following members.

Field | Value | Description
TFT_ALL | 0 | Specifies all fields.
TFT_VALID_FOR_CREATE | 1 | Specifies fields that are valid for create.
TFT_VALID_FOR_READ | 3 | Specifies fields that are valid for read.
TFT_VALID_FOR_UPDATE | 2 | Specifies fields that are valid for update.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy
  • Workflow Reference


WORKFLOW_ACTION_TYPE Class

The WORKFLOW_ACTION_TYPE class lists the possible workflow action types. Please note that although the APIs may accept any value, these are the valid values. For more information about building an action, see Actions in the Workflow Reference.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   WORKFLOW_ACTION_TYPE
[Visual Basic .NET]
Public Class WORKFLOW_ACTION_TYPE
   Inherits System.Object
[C#]
public class WORKFLOW_ACTION_TYPE: System.Object
[C++]
public __gc class WORKFLOW_ACTION_TYPE: public System.Object

The WORKFLOW_ACTION_TYPE class exposes the following integer fields.

Field | Value | Description
WFAT_ACTIVITY_ATTACHMENT | 1001 | Specifies to create activity attachment. See Action – Create Activity Attachment.
WFAT_ASSIGN | 100 | Specifies to assign an object to a new owner. See Action – Assign.
WFAT_CREATE_ACTIVITY | 1000 | Specifies to create an activity. See Action – Create Activity.
WFAT_CREATE_INCIDENT | 4000 | Specifies to create an incident (case). See Action – Create Incident.
WFAT_CREATE_NOTE | 3001 | Specifies to create a note. See Action – Create Note.
WFAT_EMAIL_TEMPLATE | 2001 | Specifies to send an e-mail message using a template. See Action – E-mail Template.
WFAT_EMAIL_TEMPLATE_2 | 2002 | [Not supported in this release.]
WFAT_EXEC | 500 | Specifies to launch a sub-process. See Action – Execute a Sub-Process.
WFAT_HALT | 600 | Specifies to halt execution. See Action – Halt.
WFAT_HANDLE_ACTIVITY | 1002 | Specifies to handle an activity. See Action – Handle Activity.
WFAT_HANDLE_INCIDENT | 4001 | Specifies to route an incident (case).
WFAT_NOTE_ATTACHMENT | 3002 | Specifies to create a note attachment. See Action – Note Attachment.
WFAT_POST_URL | 400 | Specifies to post to an external URL. See Action – Post URL.
WFAT_ROUTE | 150 | Specifies to route an object. See Action – Route.
WFAT_SEND_EMAIL | 2000 | Specifies to send an e-mail message. See Action – Send E-mail.
WFAT_SET_STATE | 300 | Specifies to change the system state. See Action – Set State.
WFAT_TIMER | 700 | Specifies set a timer. See Action – Timer.
WFAT_UPDATE | 200 | Specifies to update an object. See Action – Update.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy
  • Workflow Reference


WORKFLOW_DATA_TYPE Class

The WORKFLOW_DATA_TYPE class describes data types used in workflow object. Please note that although the APIs may accept any value, these are the valid values. For more information about the use of this class, see Conditions and Parameters in the Workflow Reference.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   WORKFLOW_DATA_TYPE
[Visual Basic .NET]
Public Class WORKFLOW_DATA_TYPE
   Inherits System.Object
[C#]
public class WORKFLOW_DATA_TYPE: System.Object
[C++]
public __gc class WORKFLOW_DATA_TYPE: public System.Object

The WORKFLOW_DATA_TYPE class exposes the following integer fields.

Field | Value | Description
WFDT_BOOLEAN | 5 | Specifies a Boolean data type.
WFDT_DATETIME | 4 | Specifies a date/time data type.
WFDT_DECIMAL | 2 | Specifies a decimal data type. See Remarks below.
WFDT_GUID | 7 | Specifies a GUID data type.
WFDT_INTEGER | 3 | Specifies an integer data type.
WFDT_STRING | 1 | Specifies a string data type.
WFDT_VARIANT | 0 | Specifies a variant data type.
WFDT_XML | 6 | Specifies an XML data type.

Remarks

When using datatype WFDT_DECIMAL, you should use caution with functions that test equality (WFPM_EQ and WFPM_NEQ) and include the mathematic operators WFPM_ADD, WFPM_SUBTRACTION, WFPM_MULTIPLICATION, or WFPM_DIVISION. Rounding of the WFDT_DECIMAL value can cause unexpected results from these operations.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy
  • Workflow Reference


WORKFLOW_ERROR_HANDLER_LEVEL Class

The WORKFLOW_ERROR_HANDLER_LEVEL class lists the levels for workflow errors. This is used for the errorhandler field in a workflow action or condition. Please note that although the APIs may accept any value, these are the valid values for this field. WORKFLOW_ERROR_HANDLER_LEVEL specifies how to handle the situation where an error occurs in the execution of an action or the evaluation of a condition. For more information about the use of this class, see Actions and Conditions in the Workflow Reference.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   WORKFLOW_ERROR_HANDLER_LEVEL
[Visual Basic .NET]
Public Class WORKFLOW_ERROR_HANDLER_LEVEL
   Inherits System.Object
[C#]
public class WORKFLOW_ERROR_HANDLER_LEVEL: System.Object
[C++]
public __gc class WORKFLOW_ERROR_HANDLER_LEVEL: public System.Object

The WORKFLOW_ERROR_HANDLER_LEVEL class exposes the following integer fields.

Field | Value | Description
WFEH_IGNORE | 0 | Specifies to ignore the error. [Not supported in this release.]
WFEH_STOP | 2 | Specifies to pause the execution and post a warning message to system event log.
WFEH_WARNING | 1 | Specifies to post a warning message to the system event log.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy
  • Workflow Reference


WORKFLOW_ERROR_SEVERITY Class

The WORKFLOW_ERROR_SEVERITY class lists the possible severities for workflow error levels. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used in the out parameter CWorkflowErrorInfo from the call to CRMProcess.Activate.

System.Object
   WORKFLOW_ERROR_SEVERITY
[Visual Basic .NET]
Public Class WORKFLOW_ERROR_SEVERITY
   Inherits System.Object
[C#]
public class WORKFLOW_ERROR_SEVERITY: System.Object
[C++]
public __gc class WORKFLOW_ERROR_SEVERITY: public System.Object

The WORKFLOW_ERROR_SEVERITY class exposes the following integer fields.

Field | Value | Description
WFES_ERROR | 2 | Indicates that there is a problem with the process that prevents activation.
WFES_MESSAGE | 0 | [Not used.]
WFES_WARNING | 1 | [Not used.]

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy
  • Workflow Reference


WORKFLOW_EVENT_TYPE Class

The WORKFLOW_EVENT_TYPE class specifies workflow event types. This class is used for the eventypecode field for workflow process. Please note that although the APIs may accept any value, these are the valid values for this field. WORKFLOW_EVENT_TYPE specifies the event that will cause the process to be instantiated. For more information about the use of this class, see Process in the Workflow Reference.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   WORKFLOW_EVENT_TYPE
[Visual Basic .NET]
Public Class WORKFLOW_EVENT_TYPE
   Inherits System.Object
[C#]
public class WORKFLOW_EVENT_TYPE: System.Object
[C++]
public __gc class WORKFLOW_EVENT_TYPE: public System.Object

The WORKFLOW_EVENT_TYPE class exposes the following integer fields.

Field | Value | Description
WFET_ASSIGNED | 0x00000002 | Specifies an object assigned event.
WFET_CREATED | 0x00000001 | Specifies an object created event.
WFET_NULL | 0x00000000 | Specifies that nothing happened. This is used for manual processes.
WFET_ROUTING | 0x00000040 | Specifies an object routing event.
WFET_STATE_CHANGED | 0x00000020 | Specifies an object state changed event.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy
  • Workflow Reference


WORKFLOW_PARAMETER_TYPE Class

The WORKFLOW_PARAMETER_TYPE class lists the possible values for workflow parameter type. Please note that although the APIs may accept any value, these are the valid values. For more information about the use of this class, see Parameters in the Workflow Reference.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   WORKFLOW_PARAMETER_TYPE
[Visual Basic .NET]
Public Class WORKFLOW_PARAMETER_TYPE
   Inherits System.Object
[C#]
public class WORKFLOW_PARAMETER_TYPE: System.Object
[C++]
public __gc class WORKFLOW_PARAMETER_TYPE: public System.Object

The WORKFLOW_PARAMETER_TYPE class exposes the following integer fields.

Field | Value | Description
WFPM_ABS | 405 | Specifies an absolute value function: abs (parameter 1). See Parameter - Function.
WFPM_ACTION | 3 | Specifies that the parameter represents an action's result. See Parameter - Action. WFPM_ACTION will evaluate the following attributes of an action log: status, createdon, objectid, objectype.
WFPM_ADD | 400 | Specifies a function to add the parameters: parameter 1 + ... + parameter n. See Parameter - Function.
WFPM_ALL_ACTIVITIES | 601 | Specifies to check whether all activities created so far by the workflow process have been closed, including previous steps. Returns true if they are all closed and false if any are not yet closed. See Parameter - Function.
WFPM_AND | 301 | Specifies parameter 1 && ... && parameter n. See Parameter - Function.
WFPM_ANY_ACTION | 602 | Specifies to check to see whether any action in current step has failed. See Parameter - Function.
WFPM_BEGIN_WITH | 200 | Specifies that parameter 1 begins with parameter 2. See Parameter - Function.
WFPM_BETWEEN | 106 | Specifies that parameter 2 < parameter 1 < parameter 3. See Parameter - Function.
WFPM_CASE | 307 | Specifies to return the first non-null parameter. See Parameter - Function.
WFPM_CONTAIN | 202 | Specifies that parameter 1 contains parameter 2. See Parameter - Function.
WFPM_DATE | 501 | Specifies the current date time. See Parameter - Function.
WFPM_DATEADD | 508 | Specifies the date add function: parameter 1 + parameter 2 (year) + parameter 3 (month) + parameter 4 (day) + parameter 5 (hour) + parameter 6 (minute). See Parameter - Function.
WFPM_DAY | 504 | Specifies the day of the month of parameter 1. See Parameter - Function.
WFPM_DIVISION | 403 | Specifies a divide function: parameter 1/parameter 2. See Parameter - Function.
WFPM_END_WITH | 201 | Specifies that parameter 1 ends with parameter 2. See Parameter - Function.
WFPM_EQ | 104 | Specifies that parameter 1 == parameter 2. See Parameter - Function. To check whether a value is or is not NULL use WFPM_ISNULL, parented by WFPM_NOT. WFPM_EQ will cause an error if one of its parameters is NULL.
WFPM_EXIST | 150 | Specifies that parameter 1 exists and is not an empty string. See Parameter - Function.
WFPM_FALSE | 305 | Specifies to always fail. See Parameter - Function.
WFPM_GEQ | 101 | Specifies that parameter 1 >= parameter 2. See Parameter - Function.
WFPM_GT | 100 | Specifies that the parameter 1 > parameter 2. See Parameter - Function.
WFPM_HOUR | 503 | Specifies the hour of parameter 1. See Parameter - Function.
WFPM_IFF | 306 | Specifies that if parameter 1 is true, return parameter 2, otherwise return parameter 3. See Parameter - Function.
WFPM_IN | 107 | Specifies that parameter 1 is one of parameter 2, parameter 3, and so on. See Parameter - Function.
WFPM_INCIDENT_QUEUE | 605 | Specifies to return the incident queue. See Parameter - Function.
WFPM_ISNULL | 151 | Specifies that parameter 1 is null. See Parameter - Function.
WFPM_LEQ | 103 | Specifies that parameter 1 <= parameter 2. See Parameter - Function.
WFPM_LT | 102 | Specifies that parameter 1 < parameter 2. See Parameter - Function.
WFPM_MATCH_SUBJECTS | 603 | Specifies to check whether parameter 2 is a high-level subject of parameter 1. See Parameter - Function.
WFPM_MINUTE | 502 | Specifies the minute of parameter 1. See Parameter - Function.
WFPM_MODULUS | 404 | Specifies a modulus function: parameter 1 % parameter 2. See Parameter - Function.
WFPM_MONTH | 506 | Specifies the month of the year of parameter 1. See Parameter - Function.
WFPM_MULTIPLICATION | 402 | Specifies a multiply function: parameter 1*...*parameter n. See Parameter - Function.
WFPM_NEQ | 105 | Specifies that parameter 1 <> parameter 2. See Parameter - Function.
WFPM_NONE | 0 | Specifies no parameter type.
WFPM_NOT | 303 | Specifies not parameter 1. See Parameter - Function.
WFPM_NULL | 152 | Specifies that a null value is always returned. See Parameter - Function.
WFPM_OR | 302 | Specifies parameter 1 || ... || parameter n. See Parameter - Function.
WFPM_PROCESS | 4 | Specifies that the parameter represents a current process instance attribute. See Parameter - Process. WFPM_PROCESS evaluates the attributes of the current process instance: lastactivityon, objectid, objecttype, processinstancestatecode, startedon, currentstepid.
WFPM_PROPERTY | 2 | Specifies that the parameter represents a property in evaluation context. See Parameter - Property.
WFPM_SELECT | 9 | Specifies that the parameter represents a select function. See Parameter - Select. Only the first result will be returned from WFPM_SELECT, even when datatype is WFDT_XML.
WFPM_STRLEN | 203 | Specifies a string length of parameter 1. See Parameter - Function.
WFPM_SUBSTR | 204 | Specifies a substring of parameter 1, starting from parameter 2 with length parameter 3. The position is zero-based. P2 counts from 0. If P2 is larger than the length of the string, then "" is returned. See Parameter - Function.
WFPM_SUBTRACTION | 401 | Specifies a subtract function: parameter 1 - parameter 2. See Parameter - Function.
WFPM_TRUE | 304 | Specifies always success. See Parameter - Function.
WFPM_USER_QUEUE | 604 | Specifies to get the user queue. See Parameter - Function.
WFPM_VALUE | 1 | Specifies that the parameter represents an immediate value. See Parameter - ImmediateValue.
WFPM_WEEKDAY | 505 | Specifies the weekday of parameter 1. See Parameter - Function.
WFPM_YEAR | 507 | Specifies the year of parameter 1. See Parameter - Function.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy
  • Workflow Reference


WORKFLOW_PROCESS_INSTANCE_EXIT_CODE Class

The WORKFLOW_PROCESS_INSTANCE_EXIT_CODE class lists exit code types for a workflow process instance. It is used to specify the value of the ExitCode parameter for the Halt Action. Please note that although the APIs may accept any value, these are the valid values.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   WORKFLOW_PROCESS_INSTANCE_EXIT_CODE
[Visual Basic .NET]
Public Class WORKFLOW_PROCESS_INSTANCE_EXIT_CODE
   Inherits System.Object
[C#]
public class WORKFLOW_PROCESS_INSTANCE_EXIT_CODE: System.Object
[C++]
public __gc class WORKFLOW_PROCESS_INSTANCE_EXIT_CODE: public System.Object

The WORKFLOW_PROCESS_INSTANCE_EXIT_CODE class exposes the following integer fields.

Field | Value | Description
WFPIEC_ABORTED | 1 | Specifies the process instance aborted.
WFPIEC_ALLABORTED | 3 | Specifies the process instance is aborted and stops the instantiation of any other processes by the event that instantiated the process instance.
WFPIEC_ALLCOMPLETED | 2 | Specifies the process instance exited successfully and stops the instantiation of any other processes by the event that instantiated the process instance.
WFPIEC_COMPLETED | 0 | Specifies the process instance exited successfully.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy
  • Workflow Reference


WORKFLOW_PROCESS_INSTANCE_STATE Class

The WORKFLOW_PROCESS_INSTANCE_STATE class lists process instance states, used for the process instance statecode field. Please note that although the APIs may accept any value, these are the valid values for this field.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   WORKFLOW_PROCESS_INSTANCE_STATE
[Visual Basic .NET]
Public Class WORKFLOW_PROCESS_INSTANCE_STATE
   Inherits System.Object
[C#]
public class WORKFLOW_PROCESS_INSTANCE_STATE: System.Object
[C++]
public __gc class WORKFLOW_PROCESS_INSTANCE_STATE: public System.Object

The WORKFLOW_PROCESS_INSTANCE_STATE class exposes the following integer fields.

Field | Value | Description
WFPIS_ABORTED | 5 | Specifies that the process is aborted.
WFPIS_ACTIVE | 1 | Specifies that the process instance is active.
WFPIS_COMPLETED | 4 | Specifies that the process is completed.
WFPIS_INIT | 0 | Specifies that the process instance is initialized but not active yet.
WFPIS_PAUSED | 3 | Specifies that the process is paused.
WFPIS_WAITING | 2 | Specifies that the process is in a waiting state.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy
  • Workflow Reference


WORKFLOW_PROCESS_STATE Class

The WORKFLOW_PROCESS_STATE class lists process state, used for the process statecode field. Please note that although the APIs may accept any value, these are the valid values for this field. For more information about the use of this class, see Process in the Workflow Reference.

This class does not need instantiation or initialization because the fields represent constant integer values.

System.Object
   WORKFLOW_PROCESS_STATE
[Visual Basic .NET]
Public Class WORKFLOW_PROCESS_STATE
   Inherits System.Object
[C#]
public class WORKFLOW_PROCESS_STATE: System.Object
[C++]
public __gc class WORKFLOW_PROCESS_STATE: public System.Object

The WORKFLOW_PROCESS_STATE class exposes the following integer fields.

Field | Value | Description
WFPS_ACTIVE | 0 | Specifies that the process is active.
WFPS_DISABLED | 2 | [Not supported in this release.]
WFPS_INACTIVE | 1 | Specifies that the process is not active.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy
  • Workflow Reference


WORKFLOW_PROCESS_TYPE Class

The WORKFLOW_PROCESS_TYPE enumeration lists workflow process types, used for the process processtypecode field of a process. Please note that although the APIs may accept any value, these are the valid values for this field. For more information about the use of this class, see Process in the Workflow Reference.

This class does not need instantiation or initialization because the fields represent constant integer values. These values are intended to be used when constructing XML string parameters used in the Microsoft CRM APIs.

System.Object
   WORKFLOW_PROCESS_TYPE
[Visual Basic .NET]
Public Class WORKFLOW_PROCESS_TYPE
   Inherits System.Object
[C#]
public class WORKFLOW_PROCESS_TYPE: System.Object
[C++]
public __gc class WORKFLOW_PROCESS_TYPE: public System.Object

The WORKFLOW_PROCESS_TYPE class exposes the following integer fields.

Field | Value | Description
WFPT_NONE | 0 | Specifies no process.
WFPT_OBJECT_PROCESS | 2 | Specifies an object process.
WFPT_OBJECT_PROCESS_TEMPLATE | 1002 | Specifies an object process template. Only one object process is allowed to run on an object at one time. Templates are used to create other object processes. Templates cannot be activated.
WFPT_PROCESS_TEMPLATE | 1000 | Specifies a generic process template. Process templates are used to create other processes. They can never be activated.
WFPT_WORKFLOW_PROCESS | 1 | Specifies a workflow process.
WFPT_WORKFLOW_PROCESS_TEMPLATE | 1001 | Specifies a workflow process template. Templates are used to create other workflow processes. Templates cannot be activated.

Requirements

Namespace: Microsoft.Crm.Platform.Types

Assembly: Microsoft.Crm.Platform.Types.dll

See Also

  • Microsoft.Crm.Platform.Proxy
  • Workflow Reference


Schemas

The following sections contain schema information:

  • Object Schemas . Documents the Microsoft CRM metabase schema.
  • Fetch XML Schema . Documents the schema for FetchXML, used in the CRMQuery class and in workflow.
  • ColumnSetXML Schema . Documents the schema for ColumnSetXML, a parameter passed into API methods that retrieve data from the Microsoft CRM database.


Object Schemas

The following table contains links to the Microsoft CRM metabase schema in XML format.

Name | Entity ID
account.xsd | 277bffc0-46d5-4d61-a00a-15ad7adeeb19
activity.xsd | 5314b3d2-3938-45fc-bcc6-8cd75a69049d
activitymimeattachment.xsd | 9693dc73-c63b-4ecc-a9f9-2e977747295a
activityparty.xsd | c9fa2e17-0287-4828-b251-e15ccf9a2e5c
annotation.xsd | 8e405cb7-f6e2-4295-bd9b-e3a1d249d14d
annualfiscalcalendar.xsd (Constructed Entity) | 22f8eac7-320d-47e8-8725-ecda0bcb3488
appointmentactivity.xsd (Constructed Entity) | bda34913-7bc6-4341-8c9e-712bb326bb9e
businessunit.xsd | e9026ae8-cb5f-441e-9fa1-e1e1ebddb532
businessunitnewsarticle.xsd | 5d34c8ee-7919-42dd-b42e-15a5daf1fc1e
chatactivity.xsd (Constructed Entity) | 801387cf-d9d5-4537-bfb7-caff8120eb7b
competitor.xsd | c6a8b665-d34d-4894-8ce7-c7ffcbf29ad3
competitoraddress.xsd | 2a4dc14b-c4bb-4da4-b5fe-7002f6b29a57
competitorcontact.xsd | 93bced88-d166-448b-923d-107860169bda
competitorcontactaddress.xsd | ed83dc15-78af-4a4a-a234-b30b3d7ba4df
competitorrevenuereport.xsd | 5b72235b-81c5-4e2e-ad31-c3e3aadf5dd9
contact.xsd | b46ee9a6-7d1d-44c8-98b3-ff179ff523fe
contract.xsd | daf44066-6974-44c7-bc87-996a672a898e
contractdetail.xsd | 3c20762d-41c8-419e-a233-7582fb9fb9e5
contracttemplate.xsd | 3b90797f-d3eb-4a41-9723-136ef3027c78
customeraddress.xsd | ed7fe7f1-157b-40f1-ac83-a14b90672596
discount.xsd | 0ca9ee35-91f0-41ff-bac0-bad4ce3ee752
discounttype.xsd | fe035396-c97c-4536-ba2b-1549c688bc55
documentindex.xsd | bacfa8c3-4f29-490c-838c-a64b121f7639
emailactivity.xsd (Constructed Entity) | 0553e2be-c4bc-4d3c-82ca-52f4605e135a
faxactivity.xsd (Constructed Entity) | a94a58d8-6b68-4cda-8e22-6c9ae86d03ce
fixedmonthlyfiscalcalendar.xsd (Constructed Entity) | dea07d97-3da8-46cb-a85d-a3a5520b23af
incident.xsd | a13f90f8-f6ef-4102-b336-09ee3429acbd
incidententryactivity.xsd (Constructed Entity) | ae067b81-1576-4fd6-a289-8c2ab0c90f8f
incidentresolutionactivity.xsd (Constructed Entity) | fca63fe6-cde1-4e23-87fc-72f0e0ad6760
integrationstatus.xsd | df117f9d-a4e9-44bb-9016-3bde97c54f43
internaladdress.xsd | 8c9afbf1-1596-4359-908f-0a06d35696ea
invoice.xsd | dd895115-cf40-4bd9-9317-0b98c66cc5c8
invoicedetail.xsd | 2e39b209-a1a6-4936-9c1a-e8b6ffe8c928
kbarticle.xsd | 4721c495-ba01-46dd-b01d-1f4bf58558e0
kbarticlecomment.xsd | 0e1f047d-e6db-49c4-b447-d2f44e5dec0f
kbarticletemplate.xsd | 41fd318f-a6f5-43f2-8886-8ed243e14cb3
lead.xsd | 58364d81-2e1e-4be1-8af6-f0be1b0213ce
leadaddress.xsd | c13fbeb4-ed40-45c2-a4ef-d09414fd97bb
letteractivity.xsd (Constructed Entity) | 49b86a84-5ee5-48ee-b9fe-bae7e23f064e
license.xsd | 3ed5e77e-715a-4af6-bc14-a7302ff6c8e0
mailinglist.xsd | 3f5b56d4-4309-4838-a0c6-8836e2555e63
monthlyfiscalcalendar.xsd (Constructed Entity) | 808e4271-2bbe-4055-b2be-61cfbccfe15a
objectauditlog.xsd | 127f4825-dde2-46a5-ae8c-02d134e37f0e
opportunity.xsd | 025929bd-4d9d-479d-88bc-dbe530f49055
opportunitycloseactivity.xsd (Constructed Entity) | 0129536d-ede0-4487-878a-998571826f41
opportunityproduct.xsd | 9c496857-f6f9-4ee6-9ebc-e7462effe0b2
ordercloseactivity.xsd (Constructed Entity) | 71046974-c064-487b-a44d-9d45883335b1
organization.xsd | 41476860-d663-453d-8a77-09a9f236738c
organizationui.xsd | 261a19cc-48c6-4138-97a9-7d741b06ad68
phonecallactivity.xsd (Constructed Entity) | c7830cf1-1b2b-4e30-855f-e60b8f48b713
pricelevel.xsd | 7d57246a-e9c9-479f-b53b-84b7e17d5400
principalownedobjects.xsd | b2988a60-8e29-46e2-ae0e-f345b4998d00
privilege.xsd | c28967fe-d20c-49b4-8393-c55d55d44d05
product.xsd | 39f27ca1-8960-45b0-8843-64796b80e227
productpricelevel.xsd | 773130ca-ab8c-4dad-b285-594707fa97dc
quarterlyfiscalcalendar.xsd (Constructed Entity) | 6d4d8cea-ca96-4ec6-b927-e55e6bf0eaf1
queue.xsd | 83192fde-50e5-4927-b662-73fcff10ff4d
queueitem.xsd | b00608ad-b017-4f8d-959c-c034fc7d38c0
quote.xsd | 210d308c-60bc-48b4-bd22-60c794bbff48
quotecloseactivity.xsd (Constructed Entity) | c6ddabd6-0b6d-4e31-9b4c-c7cc7c4a0c6b
quotedetail.xsd | 72c8d0b0-4894-4759-9caa-ca800f30e69a
role.xsd | 1ceda4d1-7ed0-49e5-8c8d-65bccb254495
roletemplate.xsd | 107b343a-fbe3-4cc3-9b85-925e6ea21ef0
salesliterature.xsd | af40c0ab-a3a1-4106-b195-7fe597a70681
salesliteratureitem.xsd | 955793a3-2467-4863-ab3a-457cce1f5779
salesorder.xsd | d8c977df-3d0d-4c23-bd1b-c27679ad0c5f
salesorderdetail.xsd | 5bd41dfe-1a8b-4850-b273-3e6da2bda16d
savedquery.xsd | db102ea5-70ca-4789-9f34-6c2665ea0ad0
savedqueryheaders.xsd | d015bae7-1b7d-4776-a82b-acdfcc28d820
semiannualfiscalcalendar.xsd (Constructed Entity) | 16c7319e-f31b-40ab-a68f-607f99c93d0e
subject.xsd | 73bfaaf2-6aad-4cb8-878b-a7e581dbfb07
subscription.xsd | db7ca0dc-0e9f-4548-8160-79e571de319b
syncentry.xsd | 9aca9d94-93d9-4d0e-903e-cdf1aa4e4299
systemuser.xsd | 2efc625d-7f01-4151-807c-03c01a09c3c5
team.xsd | 6e2a003d-1837-4b97-b4b6-42fb46a941d1
template.xsd | a861fb08-0a5c-473a-ab1b-62f9088852de
territory.xsd | 1c6d88a8-57ef-4403-92ba-1266918d758e
trackeditemhistory.xsd | f8329559-d4d5-4ba0-997c-1a9ac5113c6b
unresolvedaddress.xsd | 574fe1f7-b026-4ab1-98a3-d882e7fc2494
uom.xsd | 4e6d895e-049a-4ff0-b874-47206491fe5d
uomschedule.xsd | dc9085d0-2bd5-4281-889f-376c45d28526
userfiscalcalendar.xsd | 72e1914d-9946-43e8-b998-bb5e855000d0
usersettings.xsd | 914e6b81-a393-46a7-9338-44818510fee4
wfaction.xsd | 36149b74-9937-4ad2-8c8f-19cb7bb3b9d4
wfactionlog.xsd | 8142ae09-e0a6-478a-80cb-1a712ebeb32a
wfcondition.xsd | 4f8650ff-3291-49e0-8807-a9222edd51d8
wfeventlog.xsd | 001f100a-cf17-4769-ab11-a27fc1d25e89
wfparameter.xsd | 062d7d87-5b83-4110-9ee2-463d5316d9df
wfprocess.xsd | 2f9d7cfe-65f8-4117-8b12-b79f371d3957
wfprocessinstance.xsd | 52b666e0-5d4a-4dc5-9382-e12c5150b293
wfrule.xsd | c29cd297-b2c8-48f6-af99-8baf4bca6efe
wfrulelog.xsd | 39721385-b2f8-4016-909e-81ea45580c90
wfstep.xsd | b6366271-01ee-46e1-89c7-1922e6a052de


Fetch XML Schema

The following is the schema for the fetch XML parameter used in formulating queries against the Microsoft CRM database.

Included in this section:

  • Fetch XML Schema in BNF
  • Fetch XML Schema in XSD
  • More information about conditions
  • Examples showing how to use Fetch XML

BNF

The following describes the schema in Backus-Naur form (BNF):

FetchXml :=
   <fetch
      (page='page-number')? // default is 0
      (count='items-per-page')? // default is unbounder
      (utc-offset='utc-offset')? // default is 0
      (mapping= ('internal' | 'logical' | 'physical') )? // default is logical
      (aggregate = ('true' | 'false' | '1' | '0') )? // '1' and '0' not currently supported.  default is false
   >
      <entity name='entity-name'>
      Entity-Xml
      </entity>
   </fetch>

Entity-Xml :=
   ( <all-attributes /> | <no-attributes /> | Attribute-Xml* )
   ( Filter-Xml |
     LinkEntity-Xml |
     Order-Xml )*

LinkEntity-Xml :=
   <link-entity
      name = 'entity-name'
      (to = 'column-name')?   // the column on the remote entity
      (from = 'column-name')?  // the column on the local entity
      (alias = 'table-alias')?
      (link-type = ('natural' | 'inner' | 'outer'))?
   >
   Entity-Xml
   </link-entity>

Order-Xml :=
   <order
      attribute='attr-name'
      (descending= ('true' | 'false' | '1' | '0')?
   />

Attribute-Xml :=
   <attribute
      name='attr-name'
      (aggregate=('count') alias='alias-name')?
   />

Filter-Xml :=
   <filter
      (type= ('or' | 'and'))? // default is 'and'
   >
   ( Condition-Xml | Filter-Xml )*
   </filter>

Condition-Xml :=
   Condition-None |   // For operators like 'not-null', where there is no explicit value
   Condition-Single |  // For operators that take an attribute and a value, 'eq', for example
   Condition-Multiple  // for operators that involve collections -- 'in' or 'not-in' for example

Condition-None :=
   <condition attribute='attribute-name' operator=
      (
      'null' |
      'not-null' |
      'yesterday' |
      'today' |
      'tomorrow' |
      'next-seven-days' |
      'last-seven-days' |
      'next-week' |
      'last-week' |
      'this-week' |
      'this-month' |
      'last-month' |
      'next-month' |
      'this-year' |
      'last-year' |
      'next-year' |
      'eq-userid' |
      'ne-userid' |
      'eq-businessid' |
      'ne-businessid'
      )
   />

Condition-Single :=
   <condition attribute='attribute-name' operator=
      (
      'eq' |
      'ne' |
      'lt' |
      'gt' |
      'le' |
      'ge' |
      'like' |
      'not-like' |
      'on' |
      'on-or-before' |
      'on-or-after')
   />

condition-Multiple :=
   <condition attribute='attribute-name' operator=
      (
      'in' |
      'not-in' |
      'between' |
      'not-between' )
   Value-Xml *
   </condition>

Value-Xml :=
   <value>text</value>

XSD

The following describes the schema in XML Schema definition language (XSD) form:

<?xml version='1.0' ?>
<Schema name='fetch-schema' xmlns='urn:schemas-microsoft-com:xml-data' xmlns:dt='urn:schemas-microsoft-com:datatypes'>
   <!--

      condition element - used for capturing entity and link-entity
                     "where" clause criteria

   -->
   <ElementType name='value' content='textOnly' model='closed' />
   <ElementType name='condition' content='eltOnly' model='closed'>
      <AttributeType name='attribute' dt:type='string' required='yes' />
      <AttributeType name='operator' dt:type='enumeration' dt:values='lt gt le ge eq ne null not-null in not-in between not-between like not-like yesterday today tomorrow next-seven-days last-seven-days next-week last-week this-month last-month next-month on on-or-before on-or-after this-year last-year next-year eq-userid ne-userid eq-businessid ne-businessid' required='yes' default='eq' />
      <AttributeType name='value' dt:type='string' required='no' />
      <AttributeType name='aggregate' dt:type='enumeration' dt:values='count' required='no' />
      <AttributeType name='alias' dt:type='string' required='no' />
      <!-- -->
      <attribute type='attribute' />
      <attribute type='operator' />
   <!--
      The attribute "value" is used for all operators that need to compare against a single value (eg. eq).
      The element "value" is used for operators that need to compare against multiple values (eg. in).
      Some operators require neither the attribute "value" or the element "value" (eg. null).
   -->
      <attribute type='value' />
      <attribute type='aggregate' />
      <attribute type='alias' />
      <element type='value' minOccurs='0' maxOccurs='*' />
   </ElementType>
   <!--

      filter element - used for constructing complex conditionals
                   legal one entity and link-entity

   -->
   <ElementType name='filter' content='eltOnly' model='closed'>
      <AttributeType name='type' dt:type='enumeration' dt:values='and or' required='no' default='and' />
      <!-- -->
      <attribute type='type' />
      <element type='condition' minOccurs='0' maxOccurs='*' />
      <element type='filter' minOccurs='0' maxOccurs='*' />
   </ElementType>
   <!--

      attribute elements - used for selecting attributes from the
                      surrounding entity / link-entity, these
                      values are returned as part of the fetch

   -->
   <ElementType name='all-attributes' content='empty' model='closed' />
   <ElementType name='attribute' content='empty' model='closed'>
      <AttributeType name='name' dt:type='string' required='yes' />
      <!-- -->
      <attribute type='name' />
   </ElementType>
   <!--

   order element - used to specify a sort order

   -->
   <ElementType name='order' content='eltOnly' model='closed'>
      <AttributeType name='attribute' dt:type='string' required='yes' />
      <AttributeType name='descending' dt:type='boolean' required='no' default='false' />
      <!-- -->
      <attribute type='attribute' />
      <attribute type='descending' />
   </ElementType>
   <!--

      link-entity element - used for joining one entity to it's "parent"

   -->
   <ElementType name='link-entity' content='eltOnly' model='closed' order='many'>
      <AttributeType name='to' dt:type='string' required='no' />
      <AttributeType name='from' dt:type='string' required='no' />
      <AttributeType name='name' dt:type='string' required='yes' />
   <AttributeType name='alias' dt:type='string' required='no' />
   <AttributeType name='link-type' dt:type='string' dt:values='natural inner outer' required='no' />
      <!-- -->
      <attribute type='name' />
      <attribute type='to' />
   <attribute type='alias' />
   <attribute type='link-type' />
      <element type='all-attributes' minOccurs='0' maxOccurs='1' />
      <element type='attribute' minOccurs='0' maxOccurs='*' />
   <element type='order' minOccurs='0' maxOccurs='*' />
      <element type='filter' minOccurs='0' maxOccurs='1' />
      <element type='link-entity' />
   </ElementType>
   <!--

      entity element - used for specifying the root element for a fetch, only
                   one root entity is allowed in a given fetch, all others
                   are dependent on this entity and are marked as
                   link-entity

   -->
   <ElementType name='entity' content='eltOnly' model='closed' order='many'>
      <AttributeType name='name' dt:type='string' required='yes' />
      <!-- -->
      <attribute type='name' />
      <element type='all-attributes' minOccurs='0' maxOccurs='1' />
      <element type='attribute' minOccurs='0' maxOccurs='*' />
   <element type='order' minOccurs='0' maxOccurs='*' />
      <element type='link-entity' />
      <element type='filter' minOccurs='0' maxOccurs='1' />
   </ElementType>
   <!--

      fetch element - root element for the query

   -->
   <ElementType name='fetch' content='eltOnly' model='closed'>
      <AttributeType name='count' dt:type='int' required='no' />
   <AttributeType name='page' dt:type='int' required='no' />
   <AttributeType name='utc-offset' dt:type='int' required='no' />
   <AttributeType name='aggregate' dt:type='boolean' required='no' />
   <AttributeType name='mapping' dt:type='enumeration' dt:values='internal logical physical' required='no' />
      <!-- -->
      <attribute type='count' />
   <attribute type='page' />
   <attribute type='utc-offset' />
   <attribute type='aggregate' />
   <attribute type='mapping' />
      <element type='entity' minOccurs='1' maxOccurs='1' />
   </ElementType>
</Schema>

Conditions

The following table provides more information regarding conditions in Fetch XML.

Condition | Actual comparison | Value
equals x | eq | x
does not equal x | ne | x
is greater than x | gt | x
is greater than or equal to x | ge | x
is less than x | lt | x
is less than or equal to x | le | x
begins with x | like | x%
does not begin with x | not-like | x%
ends with x | like | %x
does not end with x | not-like | %x
contains x | like | %x%
does not contain x | not-like | %x%
exists | not-null |
does not exist | null |
anytime | not-null |
yesterday | yesterday |
today | today |
tomorrow | tomorrow |
in next 7 days | next-seven-days |
in last 7 days | last-seven-days |
next week | next-week |
last week | last-week |
this week | this-week |
this month | this-month |
last month | last-month |
next month | next-month |
this year | this-year |
next year | next-year |
last year | last-year |
on x | on | x
on or after x | on-or-after | x
on or before x | on-or-before | x
in between | between |
not between | not-between |
in | in |
not in | not-in |
equals user id | eq-userid |
does not equal user id | ne-userid |
equals business id | eq-businessid |
does not equal business id | ne-businessid |


Fetch XML Examples

The following are examples of use of the Query XML parameter. See also Fetch XML Schema.

Example 1

Return all attributes of the account entity where the owning user's last name equals the value crmlastname, first name equals the value crmfirstname, and nickname equals the value crmnickname.

<fetch mapping='logical'>
   <entity name='account'><all-attributes/>
      <link-entity name='systemuser' to='owninguser'>
         <filter type='and'>
            <condition attribute = 'lastname' operator='eq' value='crmlastname'/>
            <condition attribute='firstname' operator='eq' value='crmfirstname'/>
            <condition attribute='nickname' operator='eq' value='crmnickname'/>
         </filter>
      </link-entity>
   </entity>
</fetch>

Example 2

Return all attributes from the account entity for accounts created today.

<fetch mapping='logical'>
   <entity name='account'><all-attributes/>
      <filter type='and'>
         <condition attribute = 'createdon' operator='today'/>
      </filter>
   </entity>
</fetch>

Example 3

Return name and accountid from all accounts created within the last seven days.

<fetch mapping='logical'>
   <entity name='account'>
      <attribute name = 'name'/>
      <attribute name = 'accountid'/>
      <filter type='and'>
         <condition attribute = 'createdon' operator='last-seven-days'/>
      </filter>
   </entity>
</fetch>"

Example 4

Return contactid and birthdate from all contacts where the birth date is December 12, 2000 (time format YYYY-MM-DDTHH:MM:SSZ).

<fetch mapping='logical'>
   <entity name='contact'>
      <attribute name = 'contactid'/>
      <attribute name = 'birthdate'/>
      <filter type='and'>
         <condition attribute = 'birthdate' operator='on' value='2000-12-12T00:00:00Z'/>
      </filter>
   </entity>
</fetch>

Example 5

Return all attributes from accounts where the account name either starts with "a" or starts with "d".

<fetch mapping='logical'>
   <entity name='account'><all-attributes/>
      <filter type='or'>
         <condition attribute = 'name' operator='like' value='a%'/>
         <condition attribute = 'name' operator='like' value='d%'/>
      </filter>
   </entity>
</fetch>

Example 6

Return name and accountid from all accounts where the name starts with either "a" or "x", or the name ends with "!".

<fetch mapping='logical'>
   <entity name='account'>
      <attribute name = 'name'/>
      <attribute name = 'accountid'/>
      <filter type='or'>
         <condition attribute = 'name' operator='like' value='a%'/>
         <condition attribute = 'name' operator='like' value='x%'/>
         <condition attribute = 'name' operator='like' value='%!'/>
      </filter>
   </entity>
</fetch>

Example 7

Retrieve the ticker symbol of the account whose name is "My Account".

<fetch mapping='logical'>
   <entity name='account'>
      <attribute name='tickersymbol' />
      <filter type='and'>
           <condition attribute='name' operator='eq' value='My Account' />
      </filter>
   </entity>
</fetch>

Example 8

Retrieve all leads that were created within the last seven days.

<fetch mapping='logical'>
   <entity name='lead'>
      <all-attributes />
      <filter type='and'>
         <condition attribute='createdon' operator='last-seven-days' />
      </filter>
   </entity>
</fetch>

Example 9

Retrieve all contacts whose first name begins with "A" or last name ends with "Z". Sort the result set in ascending order by last name.

<fetch mapping='logical'>
   <entity name='contact'>
   <attribute name='firstname' />
   <attribute name='lastname' />
   <filter type='or'>
      <condition attribute='firstname' operator='like' value='A%' />
      <condition attribute='lastname' operator='like' value='%Z' />
   </filter>
   <order attribute='lastname' descending='false' />
</fetch>

Example 10

Retrieve the number of users in the system.

<fetch mapping='logical' aggregate='true'>
   <entity name='systemuser'>
      <attribute name='systemuserid' aggregate='count' alias='number' />
   </entity>
</fetch>

Example 11

Retrieve the first 10 account records created by user Jeff Smith in the last month.

<fetch mapping='logical' page='1' count='10'>
   <entity name='account'>
      <all-attributes />
      <link-entity name='systemuser' to='createdby'>
            <filter type='and'>
                  <condition attribute='firstname' operator='eq' value='Jeff' />
                  <condition attribute='lastname' operator='eq' value='Smith' />
            </filter>
      </link-entity>
      <filter type='and'>
            <condition attribute='createdon' operator='last-month' />
      </filter>
   </entity>
</fetch>


ColumnSet XML Schema

This is a parameter that is passed into many API methods that retrieve data from the Microsoft CRM database. The following describes the schema for this parameter:

ColumnSetXml :=
   <columnset
      (page='page-number')?
      (count='items-per-page')? >
      ( ColumnXml | OrderXml | FilterXml ) *
   </columnset>

ColumnXml :=
   <column>column-name</column>

OrderXml := AscendXml | DescendXml

AscendXml :=
   <ascend>column-name</ascend>

DescendXml :=
   <descend>column-name</descend>

FilterXml := NullFilterXml | SingleFilterXml | MultipleFilterXml

NullFilterXml :=
   <filter
      column='column-name'
      operator=('null' | 'not-null') />

SingleFilterXml :=
   <filter
      column='column-name'
      (attribute='attribute-name')?
      operator=('eq' | 'neq' | 'like' )
      value='value-data' />

MultipleFilterXml :=
   <filter
      column='column-name'
      (attribute='attribute-name')?
      operator='in'
      value='(value-data)?(,value-data)*' />

The following table shows the valid operators for filter.

Operator | Description
eq | Attribute equals value
neq | Attribute does not equal value
like | Attribute matches the pattern specified by value
null | Attribute has a null value
not-null | Attribute does not have a null value


ColumnSet XML Examples

The following are examples of use of the Query XML parameter. See also ColumnSet XML Schema.

To retrieve all columns, pass a null string for the column set parameter.

Example 1

This example for accounts uses the ascend tag to order the results and the filter tag with the like operator to get only those accounts that begin with the letter "A".

string strColumnSetXml = "<columnset>";
strColumnSetXml += "<column>name</column>";
strColumnSetXml += "<column>accountnumber</column>";
strColumnSetXml += "<column>numberofemployees</column>";
strColumnSetXml += "<column>websiteurl</column>";
strColumnSetXml += "<ascend>accountnumber</ascend>";
strColumnSetXml += "<filter column='name' operator='like'  value='A' />";
strColumnSetXml += "</columnset>";

Example 2

This example for leads uses the descend tag to order the results and uses the filter tag to search for leads that have one of two jobtitles.

string strColumnSetXml = "<columnset>";
strColumnSetXml += "<column>leadid</column>";
strColumnSetXml += "<descend>leadid</descend>";
//use multiple filters.
strColumnSetXml += "<filter column='jobtitle' operator='in' value='developer,marketer' />";
strColumnSetXml += "</columnset>";


Workflow Reference

In Microsoft CRM, workflow and rule management can be used to set up sales processes and is also used for routing of activities, leads and opportunities. This section contains the details needed to build a workflow process using the Microsoft CRM SDK. For a definition of terms used in workflow, see the section on Workflow and Rule Management in the Microsoft CRM Object Model.

Note Workflow processes created through the methods in CRMProcess and CRMProcessController will not display any details in the Microsoft CRM Workflow Manager and Workflow Monitor Workflow tools. You will be able to see the line items for your custom processes in these tools, but the detail windows will be empty.

The following diagram shows the object model for a workflow object.

Workflow object model

The following topics describe each of the entities that comprise a workflow:

  • Process
  • Steps
  • Actions
  • Rules
  • Conditions
  • Parameters

When a process is activated, a clone of this process is created. It is this clone that the process instances run on. This is so that the original process can be modified or deleted without affecting the process instances. Due to this implementation, the GUIDs that are returned from CRMProcessController APIs and that are listed in errors in the System Event Log refer to GUIDs from the cloned process.


Process

A process is an encapsulation of an entire business policy or business process. Processes are made up of interrelated steps, actions, and rules. The following events can instantiate a process: Create, Assign, State change, Route (activities and incidents only), and manual (calling Execute).

The following figure shows a complete process.

The XML schema is described by wfprocess.xsd.

Valid process operations are:

  • Create a process
  • Delete a process
  • Clone (make a copy of) a process
  • Modify an existing inactive process
  • Activate or deactivate a process
  • View a process

Field: eventtypecode

The possible values for the eventtypecode field are defined by WORKFLOW_EVENT_TYPE.

Field: statecode

The possible values for the statecode field are defined by WORKFLOW_PROCESS_STATE.

Field: processcode

The processcode attribute is reserved for application use.

Field: processtypecode

The possible values for the processtypecode field are defined by WORKFLOW_PROCESS_TYPE.


Objects that trigger workflow

The following table lists the entity types that can trigger workflow rules and processes. Only a subset of this list is supported using the Microsoft CRM Workflow Manager tool. For the entity type codes, see ObjectType.

Object type | Entity type code | Supported in Workflow Manager
Account | otAccount | Yes
Activity | otActivity | No
Annotation | otAnnotation | No
BusinessUnit | otBusinessUnit | No
Contact | otContact | Yes
Contract | otContract | Yes
ContractDetail | otContractDetail | No
EmailActivity | otEmailActivity | No
Incident (Case) | otIncident | Yes
Invoice | otInvoice | Yes
InvoiceDetail | otInvoiceDetail | No
Lead | otLead | Yes
Opportunity | otOpportunity | Yes
Order | otSalesOrder | Yes
Quote | otQuote | Yes
QuoteDetail | otQuoteDetail | No
Role | otRole | No
SalesOrder | otSalesOrder | No
SalesOrderDetail | otSalesOrderDetail | No
SystemUser | otSystemUser | No
Team | otTeam | No
Template | otTemplate | No
UserSettings | otUserSettings | No
WFProcess | otWFProcess | No

See Also

  • Process


Objects acted on by workflow processes

The following table lists the entity types that can be acted on by a workflow process. For example, a process running on an opportunity could update the parent account or contact of the opportunity. For the entity type codes, see ObjectType.

Object type | Entity type code
Account | otAccount
Activity | otActivity
Annotation | otAnnotation
Article | otKbArticle
ArticleTemplate | otKbArticleTemplate
BusinessUnit | otBusinessUnit
Competitor | otCompetitor
Contact | otContact
Contract | otContract
ContractDetail | otContractDetail
ContractTemplate | otContractTemplate
DiscountType | otDiscountType
DocumentIndex | otDocumentIndex
EmailActivity | otEmailActivity
Incident (Case) | otIncident
IntegrationStatus | otIntegrationStatus
Invoice | otInvoice
InvoiceDetail | otInvoiceDetail
Lead | otLead
Opportunity | otOpportunity
Order | otSalesOrder
Organization | otOrganization
PriceLevel | otPriceLevel
Product | otProduct
Queue | otQueue
QueueItem | otQueueItem
Quote | otQuote
QuoteDetail | otQuoteDetail
Role | otRole
SalesLiterature | otSalesLiterature
SalesOrder | otSalesOrder
SalesOrderDetail | otSalesOrderDetail
SavedQuery | otSavedQuery
Subject | otSubject
SystemUser | otSystemUser
Team | otTeam
Template | otTemplate
Territory | otTerritory
UoMSchedule | otUoMSchedule
UserSettings | otUserSettings
WFProcess | otWFProcess

See Also

  • Process


Steps

A step encapsulates a set of actions and a set of rules (decision and links to potential next steps).

The following figure shows a complete step.

The XML schema is described by wfstep.xsd.

Field: stepcode

The stepcode field is reserved for application use.

Field: steptypecode

The steptypecode field is reserved for application use.


Actions

Actions are predefined procedures that execute on entry to a step. Actions can include the creation of new entities, changes to the currently entity, and calls to external systems. Actions are fired serially, from the top down, on entry of their associated step.

The XML schema is described by wfaction.xsd.

Field: actioncode

The actioncode attribute is reserved for application use.

Field: actiontypecode

The possible values for the actiontypecode field are defined by WORKFLOW_ACTION_TYPE.

Field: orderofexecution

This field specifies which action should be executed first. For example, an action with an orderofexecution of 1 executes before an action in the same step with an orderofexecution of 2.

Field: errorhandler

The possible values for the errorhandler field are defined by WORKFLOW_ERROR_HANDLER_LEVEL.

Each action type requires a different set of action parameters. The following sections provide those details.

Action type
Send Email
Email Template
CreateActivity
CreateIncident
Create an Attachment for Activity
Handle an Activity
Handle an Incident
Create Note
Note Attachment
Assign New Owner
Route
Update
Set State
Post URL
Execute a Sub-Process
Halt
Timer


Action - Send Email

This action sends an e-mail. The required action parameters are as follows:

Required parameters | Description
EmailXml | The XML schema is described by emailactivity.xsd.
EmailPartiesXml | The XML schema is described by activityparty.xsd.
Attachment | Specifies the path to the file on the Microsoft CRM Server.

The following diagram shows the schema for this action.

Action - Send E-mail

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Email Template

This action sends an email using a template. The required action parameters are as follows:

Required parameters | Description
Template ID | The ID of the e-mail template.
Sender Type | The security principal type of the sender. See SecurityPrincipalType.
Sender ID | The ID of the sender. This ID must match the sender type.
Recipient 1..Recipient N | Specifies the ID of each recipient. See the Note below.

The following diagram shows the schema for this action.

Action - Email Template

Note The process will fail silently if the recipient parameter does not have an e-mail address. For example, if the recipient is an Account without an e-mail address, no e-mail activities are created and no error is reported.

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Create Activity

This action creates an activity. The required action parameters are as follows:

Required parameters | Description
ActivityXml | The XML schema is described by activity.xsd.

The optional action parameters are as follows:

Optional parameters | Description
ActivityPartiesXml | If present, it constructs a two-level XML string conforming to the XML schema described by activityparty.xsd.

The following diagram shows the schema for this action.

Action - Create Activity

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Create Incident

This action creates an incident. The required action parameters are as follows:

Required parameters | Description
IncidentXml | The XML schema is described by incident.xsd.

The following diagram shows the schema for this action.

Action - Create Incident

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Create an Attachment for Activity

This action creates an attachment for an activity. The required action parameters are as follows:

Required parameters | Description
AttachmentXML | The XML schema is described by activitymimeattachment.xsd.
FileName | Specifies the path to the file on the Microsoft CRM Server.

The following diagram shows the schema for this action.

Action - Create Activity Attachment

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Handle Activity

This action handles an activity. The required action parameters are as follows:

Required Parameters | Description
ActivityId | The ID of the activity to handle.
UserId | The ID of the user handling the activity.

The following diagram shows the schema for this action.

Action - Handle Activity

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Handle Incident

This action handles an incident. The required action parameters are as follows:

Required Parameters | Description
IncidentId | The ID of the incident to handle.
UserId | The ID of the user handling the incident.

The following diagram shows the schema for this action.

Action - Handle Incident

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Create Note

This action creates a note. The required action parameters are as follows:

Required parameters | Description
AnnotationXml | The XML schema is described by annotation.xsd.

The following diagram shows the schema for this action.

Action - Create Note

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Note Attachment

This action creates a note attachment. The required action parameters are as follows:

Required parameters | Description
NoteId | The ID of the note that is being attached.
FileName | Specifies the path to the file on the Microsoft CRM Server.

The following diagram shows the schema for this action.

Action - Note Attachment

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Assign New Owner

This action assigns an object to the specified security principal. The required action parameters are as follows:

Required parameters | Description
Object type | The type of the object being assigned. See ObjectType.
Object Id | The ID of the object.
Security principal type | The type of security principal the object is being assigned to. See Remarks below. See SecurityPrincipalType.
Security principal Id | The ID of the security principal.

The following diagram shows the schema for this action.

Action - Assign New Owner

Remarks

Note The Microsoft CRM application does not support business-object assignment to teams. Therefore, any solutions built using that assign an object to a team will not be supported by the Microsoft CRM application.

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Route

This action routes an object to the specified queue. The required action parameters are as follows:

Required parameters | Description
Object type | The type of the object being assigned. See ObjectType.
Object id | The ID of the object.
Source queue id | The ID of the source queue.
Route type | The type of the route. See ROUTE_TYPE_CODE.
Destination queue id | The ID of the destination queue.

The following diagram shows the schema for this action.

Action - Route

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Update

This action updates an object. The required action parameters are as follows:

Required parameters | Description
Object Type | The type of the object being updated. See ObjectType.
Object Id | The ID of the object.
Entity Xml | Specifies the update XML for the object. The XML schema is described by the specified object type. See ObjectSchemas.

The following diagram shows the schema for this action.

Action - Update

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Set State

This action sets the state of an object. The required action parameters are as follows:

Required parameters | Description
Object type | The type of the object being assigned. See ObjectType.
Object Id | The ID of the object.
Object State value | The new object state value as specified in Microsoft.Crm.Platform.Types Namespace.

The following diagram shows the schema for this action.

Action - Set State

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Post URL

This action allows you to post data to a URL.

Note Since the Post URL action sends data outside of Microsoft CRM, please ensure that the posted information abides by your businesses privacy standards and the site you are posting to is a known or trusted site.

The required action parameters are as follows:

Required parameters | Description
Url | The URL to post data to. This URL must specify a dynamic page that can accept data such as an ASP or ASPX.
Parameter 1..Parameter N | The parameters appending to the URL. Each must have a tagname.

The following diagram shows the schema for this action.

Action - Post URL

Usage Example:

The following is an example asp page to receive the posted URL.

<%
   Set FSO = CreateObject("Scripting.FileSystemObject")
   Set LogFile = FSO.OpenTextFile("c:\posturl.txt", 2, True)
   LogFile.WriteLine Request.Form("accountid")
%>

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Execute a Sub-Process

This action executes a sub process. The required action parameters are as follows:

Required parameters | Description
Sub process Id | The ID of the sub-process.
Object type | The type of the object the sub-process will execute on. See ObjectType.
Object Id | The ID of the object.

The following diagram shows the schema for this action.

Action - Execute a Sub-Process

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Halt

This action halts the execution of the process. If no parameter is supplied, then the exitcode is WFPIEC_COMPLETED by default. The optional action parameters are as follows:

Optional parameters | Description
ExitCode | Specifies the exit code for the process instance. See WORKFLOW_PROCESS_INSTANCE_EXIT_CODE.

The following diagram shows the schema for this action.

Action - Halt

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Action - Timer

The timer action creates an event that will fire at the specified DueTime. This event causes the conditions of the current step to be reevaluated. The timer action should be used in conjunction with a condition that verifies that the current DateTime is greater than or equal the DateTime when the event should fire. This way a process can be made to wait at a specified step until a certain time.

The required action parameters are as follows:

Required parameters | Description
DueTime | Specifies when the Timer event should fire. This parameter should be in DateTime format.

The following diagram shows the schema for this action.

Action - Timer

See Also

  • Actions
  • WORKFLOW_ACTION_TYPE


Rules

A rule is a container for conditions and a link to a next step in a process. When a rule evaluates to true, meaning all the conditions associated to the rule evaluate to true, it allows the process to progress by either moving to the next step or terminating the entire process.

The following figure shows two workflow rules for a step.

The XML schema is described by wfrule.xsd.

Supported actions for rules are:

  • Rules can be added to a step.
  • Rules can be deleted from a step.
  • Rules can be edited.
  • Rule evaluation priority can be changed.

Field: nextstepid

The field nextstepid either points to an existing stepid of the same process or is NULL. If the rule is evaluated to true, flow will move to the specified step; if nextstepid is null, the process instance will stop execution.

Field: orderofevaluation

The field orderofevaluation specifies which rule should be evaluated first. For example, a rule with an orderofevaluation of 1 is evaluated before a rule with an orderofevaluation of 2.

See Also

  • Conditions

Field: rulecode

The field rulecode is reserved for application use.

Field: ruletypecode

The field ruletypecode is reserved for application use.


Conditions

A condition is a hierarchy of parameters that is evaluated to a Boolean value. Each condition has one top-level parameter that is evaluated as the result of the condition.

The XML schema is described by wfcondition.xsd.

Field: datatype

The possible values for the datatype field are defined by WORKFLOW_DATA_TYPE.

Field: orderofevaluation

This field specifies which condition should be evaluated first. For example, a condition with an orderofevaluation of 1 is evaluated before a condition in the same rule with an orderofevaluation of 2.

Field: errorhandler

The possible values for the errorhandler field are defined by WORKFLOW_ERROR_HANDLER_LEVEL.

Field: conditioncode

The field conditioncode is reserved for application use.

Field: conditiontypecode

The field conditiontypecode is reserved for application use.

Example

The following diagram shows an example of the schema for a condition with an equal condition parameter (parametertypecode = WFPM_EQ).


Parameters

A parameter describes a value used in a condition or action. ActionParameter and ConditionParameter have exactly the same semantics and syntax.

It is best practice to include the datatype when you are creating a parameter. WFPM_EQ, WFPM_NEQ, WFPM_GT, WFPM_LT, WFPM_GEQ, WFPM_LEQ, WFPM_IN, and WFPM_BETWEEN all use the datatype of the first parameter to determine what datatype to use in the evaluation. If the first parameter is a parameter function without a datatype specified, then the evaluation will result in an error.

The XML schema is described by wfparameter.xsd.

Field: datatype

The possible values for the datatype field are defined by WORKFLOW_DATA_TYPE.

Field: parametertypecode

The possible values for the parametertypecode field are defined by WORKFLOW_PARAMETER_TYPE. For more information about each parameter type, see the topics in this section.

Field: orderofevaluation

This field specifies which parameter is first, second and so on.

Field: parametercode

The field parametercode is reserved for application use.


Basic Parameter Types

This table lists the basic parameter types. The complete list of parameter types can be found in WORKFLOW_PARAMETER_TYPE. Details for the basic parameter types can be found below.

Feature | Parameter type
An immediate value | WFPM_VALUE
An attribute of an object | WFPM_PROPERTY
An attribute of process instance | WFPM_PROCESS
An attribute of action log | WFPM_ACTION
A select statement | WFPM_SELECT
A function | There are many types; see below.

See Also

  • Parameters
  • WORKFLOW_DATA_TYPE
  • WORKFLOW_PARAMETER_TYPE


Parameter - Immediate Value

An immediate value parameter evaluates to the hard coded value specified or to the string specified with substitutions.

The following diagram shows the schema for this type of parameter.

For WFDT_STRING and WFDT_XML, a WFPM_VALUE parameter may have zero to many child parameters for substitution, as shown in the following figure.

Child parameters for the immediate value

Substitution only works for WFDT_STRING or WFDT_XML types. It replaces all the occurrences of &varname; of the string value with the value of the variable. If a parameter is evaluated to null, an empty string is used for that variable.

Examples

<wfparameter>
<parametertypecode>WFPM_VALUE</parametertypecode>
<datatype>WFDT_XML</datatype>
<value>
<activity><subject>&abc;</subject></activity>
</value>
</wfparameter>

After creating this parameter, use the ID in the next parameter.

<wfparameter>
<parametertypecode>WFPM_VALUE</parametertypecode>
<datatype>WFDT_STRING</datatype>
   <name>abc</name>
   <value>hello</value>
   <parentid>{93639AD8-CA01-4B16-B09C-EFEE53FA8799}</parentid>
</wfparameter>

This evaluates to the following XML:
<activity><subject>hello</subject></activity>

If the datatype of a parameter is WFDT_XML, and its substitution children are not WFDT_XML, XML escaping is done for the child value before the substitution.

See Also

  • Parameters
  • WORKFLOW_DATA_TYPE
  • WORKFLOW_PARAMETER_TYPE


Parameter - Property

A property parameter evaluates to the runtime value of the attribute specified by attributeid for the object specified.

The following diagram shows the schema for this type of parameter.

If ObjectId is not null, this indicates to retrieve the property specified by AttributeId for the object specified by ObjectId.

If ObjectId is null and there are no child parameters, this indicates to evaluate the property specified by AttributeId for the bound object.

If ObjectId is null and there is one child parameter, this indicates to evaluate the child parameter as ObjectId, and then evaluate the property specified by AttributeId for the object.

See Also

  • Parameters
  • WORKFLOW_DATA_TYPE
  • WORKFLOW_PARAMETER_TYPE


Parameter - Process

A process parameter evaluates to the runtime value of the attribute specified by attributeid for the process instance.

The following diagram shows the schema for this type of parameter.

See Also

  • Parameters
  • WORKFLOW_DATA_TYPE
  • WORKFLOW_PARAMETER_TYPE


Parameter - Action

Parameter – Action

An action parameter evaluates to the runtime value of the action log attribute specified by attributeid for the action specified by refactionid.

The following diagram shows the schema for this type of parameter.

See Also

  • Parameters
  • WORKFLOW_DATA_TYPE
  • WORKFLOW_PARAMETER_TYPE


Parameter - Select

The evaluation of the select parameter depends on whether the value field is null or if it specifies an attribute name. It also depends on the query that is specified by the query child parameter. The query child parameter is specified as Fetch XML. See Fetch XML Schema.

The following diagram shows the schema for this type of parameter.

If value is null and datatype is WFDT_BOOLEAN, this will return true if the execution of the query returns a non-empty result set.

If value is null and datatype is WFDT_XML, this will return an XML string for the result set.

If value is not null, this will execute the query and then get the property named by value from the result set.

See Also

  • Parameters
  • WORKFLOW_DATA_TYPE
  • WORKFLOW_PARAMETER_TYPE


Parameter - Function

The following table describes the different function parameter types.

Description | Parameter type | Data type | Sub-parameters
P1 > P2 | WFPM_GT | WFDT_BOOLEAN | P1, P2: {int, decimal, string, datetime}
P1 >= P2 | WFPM_GEQ | WFDT_BOOLEAN | P1, P2: {int, decimal, string, datetime}
P1 < P2 | WFPM_LT | WFDT_BOOLEAN | P1, P2: {int, decimal, string, datetime}
P1 <= P2 | WFPM_LEQ | WFDT_BOOLEAN | P1, P2: {int, decimal, string, datetime}
P1 = P2 | WFPM_EQ | WFDT_BOOLEAN | P1, P2: {int, decimal, string, datetime, GUID, bool} See Note below.
P1 <> P2 | WFPM_NEQ | WFDT_BOOLEAN | P1, P2: {int, decimal, string, datetime, GUID, bool} See Note below.
P1 is between P2 and P3 | WFPM_BETWEEN | WFDT_BOOLEAN | P1, P2, P3: {int, decimal, string, datetime}
P1 is one of {P2, … Pn} | WFPM_IN | WFDT_BOOLEAN | P1, P2, …, Pn: {int, decimal, string, datetime, GUID, bool}
P1 is not null | WFPM_EXIST | WFDT_BOOLEAN | P1
Always null | WFPM_NULL | - | -
Return P1 is null | WFPM_ISNULL | - | P1
P1 begins with P2 | WFPM_BEGIN_WITH | WFDT_BOOLEAN | P1, P2: string
P1 ends with P2 | WFPM_END_WITH | WFDT_BOOLEAN | P1, P2: string
P1 contains P2 | WFPM_CONTAIN | WFDT_BOOLEAN | P1, P2: string
Return the length of P1 | WFPM_STRLEN | WFDT_INTEGER | P1, P2: string
A substring of P1 starting at P2 or A substring of P1 starting at P2 with length P3 | WFPM_SUBSTR | WFDT_STRING | P1:string; P2: int or P1: string; P2, P3: int
P1 && … && Pn | WFPM_AND | WFDT_BOOLEAN | P1, …, Pn:bool
P1 || … || Pn | WFPM_OR | WFDT_BOOLEAN | P1, …, Pn:bool
Not P1 | WFPM_NOT | WFDT_BOOLEAN | P1:bool
Always true | WFPM_TRUE | WFDT_BOOLEAN | -
Always false | WFPM_FALSE | WFDT_BOOLEAN | -
If P1 is true, return P2. Otherwise return P3 (or null) | WFPM_IFF |  | P1, P2, [P3]
Return the first non-null value of P1, … Pn | WFPM_CASE |  | P1, …, Pn
P1 + … + Pn | WFPM_ADD | WFDT_INTEGER WFDT_DECIMAL WFDT_STRING | P1, …, Pn: {int, decimal, string} See Note below.
P1 – P2 | WFPM_SUBTRACTION | WFDT_INTEGER WFDT_DECIMAL | P1, P2: {int, decimal} See Note below.
P1 * … * Pn | WFPM_MULTIPLICATION | WFDT_INTEGER WFDT_DECIMAL | P1, …, Pn: {int, decimal} See Note below.
P1 / P2 | WFPM_DIVISION | WFDT_INTEGER WFDT_DECIMAL | P1, P2: {int, decimal} See Note below.
P1 % P2 | WFPM_MODULUS | WFDT_INTEGER | P1, P2: int
Absolute value of P1 | WFPM_ABS | WFDT_INTEGER WFDT_DECIMAL | P1: {int, decimal}
Current date time | WFPM_DATE | WFDT_DATETIME | -
Minute of P1 | WFPM_MINUTE | WFDT_INTEGER | P1: datetime
Hour of P1 | WFPM_HOUR | WFDT_INTEGER | P1: datetime
Day of P1 | WFPM_DAY | WFDT_INTEGER | P1: datetime
Weekday of P1 | WFPM_WEEKDAY | WFDT_INTEGER | P1: datetime
Month of P1 | WFPM_MONTH | WFDT_INTEGER | P1: datetime
Year of P1 | WFPM_YEAR | WFDT_INTEGER | P1: datetime
P1 + P2(year) + P3(month) + P4(day) + P5(hour) + P6(minute) | WFPM_DATEADD | WFDT_DATETIME | P1: datetime; P2, P3, P5, P6: int
All activities were completed | WFPM_ALL_ACTIVITIES | WFDT_BOOLEAN | -
Any actions of current step were failed | WFPM_ANY_ACTION | WFDT_BOOLEAN | -
Subject1 equals to Subject2 or Subject2 is at high-level hierarchy to Subject1 | WFPM_MATCH_SUBJECTS | WFDT_BOOLEAN | Subject1, Subject2: GUID
Get the ID of user queue by queue type | WFPM_USER_QUEUE | WFDT_GUID | User: GUID, QueueType: int
Get the ID of incident queue | WFPM_INCIDENT_QUEUE | WFDT_GUID | IncidentId: GUID

Note When using datatype WFDT_DECIMAL, you should use caution with functions that test equality (WFPM_EQ and WFPM_NEQ) and include the mathematic operators WFPM_ADD, WFPM_SUBTRACTION, WFPM_MULTIPLICATION or WFPM_DIVISION. Rounding of the WFDT_DECIMAL value can cause unexpected results from these operations.

See Also

  • Parameters
  • WORKFLOW_DATA_TYPE
  • WORKFLOW_PARAMETER_TYPE


Object Types

The following table maps object type codes between ObjectType class, Microsoft CRM application display name, and the corresponding XML schema table.

Object type code | Display name | Platform name | XML schema name
1 | Account | otAccount | account
134 | Activity | otActivity | activity
1001 | Attachment | otActivityMimeAttachment | activitymimeattachment
135 | Activity Party | otActivityParty | activityparty
5 | Note | otAnnotation | annotation
2000 | Annual Fiscal Calendar | otAnnualFiscalCalendar | annualfiscalcalendar
142 | Appointment | otAppointmentActivity | activity
10 | Business Unit | otBusinessUnit | businessunit
132 | Announcement | otBusinessUnitNewsArticle | businessunitnewsarticle
139 | Chat | otChatActivity | activity [Not supported in this release.]
123 | Competitor | otCompetitor | competitor
1004 | Not applicable | otCompetitorAddress | competitoraddress
130 | Not applicable | otCompetitorContact | competitorcontact
1005 | Not applicable | otCompetitorContactAddress | competitorcontactaddress
1007 | Not applicable | otCompetitorRevenueReport | competitorrevenuereport
2 | Contact | otContact | contact
1010 | Contract | otContract | contract
1011 | Contract Line | otContractDetail | contractdetail
2011 | Contract Template | otContractTemplate | contracttemplate
1071 | Address | otCustomerAddress | customeraddress
1013 | Discount | otDiscount | discount
1080 | Discount List | otDiscountType | discounttype
126 | Answer | otDocumentIndex | documentindex
138 | E-mail | otEmailActivity | emailactivity
1014 | Not applicable | otExactDocumentMatch | [Not supported in this release.]
128 | Not applicable | otFAQList | [Not supported in this release.]
136 | Fax | otFaxActivity | activity
2004 | Fixed Monthly Fiscal Calendar | otFixedMonthlyFiscalCalendar | fixedmonthlyfiscalcalendar
112 | Case | otIncident | incident
1081 | Not applicable | otIncidentEntryActivity | incidententryactivity
140 | Resolution | otIncidentResolutionActivity | activity
3000 | Not applicable | otIntegrationStatus | integrationstatus
1003 | Not applicable | otInternalAddress | internaladdress
1090 | Invoice | otInvoice | invoice
1091 | Invoice Product | otInvoiceDetail | invoicedetail
127 | Article | otKbArticle | kbarticle
1082 | Article Comment | otKbArticleComment | kbarticlecomment
1016 | Article Template | otKbArticleTemplate | kbarticletemplate
4 | Lead | otLead | lead
1017 | Not applicable | otLeadAddress | leadaddress
141 | Letter | otLetterActivity | activity
131 | Not applicable | otLightweightContact | [Not supported in this release.]
2012 | Not applicable | otLWContact | [Not supported in this release.]
2014 | Not applicable | otMailingList | mailinglist
2003 | Monthly Fiscal Calendar | otMonthlyFiscalCalendar | monthlyfiscalcalendar
0 | Not applicable | otNone | Not applicable
3 | Opportunity | otOpportunity | opportunity
145 | Resolution | otOpportunityCloseActivity | activity
1083 | Opportunity Product | otOpportunityProduct | opportunityproduct
147 | Resolution | otOrderCloseActivity | activity
1019 | Organization | otOrganization | organization
1021 | Not applicable | otOrganizationUI | organizationui
137 | Phone Call | otPhoneCallActivity | activity
1022 | Price List | otPriceLevel | pricelevel
1023 | Not applicable | otPrivilege | privilege
1024 | Product | otProduct | product
1026 | Price List Item | otProductPriceLevel | productpricelevel
2002 | Quarterly Fiscal Calendar | otQuarterlyFiscalCalendar | quarterlyfiscalcalendar
2020 | Queue | otQueue | queue
2029 | Queue Item | otQueueItem | queueitem
1084 | Quote | otQuote | quote
146 | Resolution | otQuoteCloseActivity | activity
1085 | Quote Product | otQuoteDetail | quotedetail
1036 | Role | otRole | role
1037 | Not applicable | otRoleTemplate | roletemplate
1038 | Sales Literature | otSalesLiterature | salesliterature
1070 | Document | otSalesLiteratureItem | salesliteratureitem
1088 | Order | otSalesOrder | salesorder
1089 | Order Product | otSalesOrderDetail | salesorderdetail
1039 | View | otSavedQuery | savedquery
1040 | Not applicable | otSearchCriterion | [Not supported in this release.]
1041 | Not applicable | otSearchLog | [Not supported in this release.]
2001 | Semiannual Fiscal Calendar | otSemiAnnualFiscalCalendar | semiannualfiscalcalendar
129 | Subject | otSubject | subject
1044 | Not applicable | otSuggestedExactMatch | [Not supported in this release.]
1045 | Not applicable | otSuggestedSearchCriterion | [Not supported in this release.]
8 | User | otSystemUser | systemuser
9 | Team | otTeam | team
2010 | E-mail Template | otTemplate | template
2013 | Territory | otTerritory | territory
2028 | Not applicable | otTrackedItemHistory | trackeditemhistory
1054 | Not applicable | otUnit | [Not supported in this release.]
1055 | Unit | otUoM | uom
1056 | Unit Group | otUoMSchedule | uomschedule
1086 | Not applicable | otUserFiscalCalendar | userfiscalcalendar
150 | Not applicable | otUserSettings | usersettings
1061 | Not applicable | otWFAction | wfaction
1062 | Not applicable | otWFActionLog | wfactionlog
1064 | Not applicable | otWFCondition | wfcondition
1065 | Not applicable | otWFEventLog | wfeventlog
1066 | Not applicable | otWFParameter | wfparameter
121 | Rule | otWFProcess | wfprocess
122 | Process | otWFProcessInstance | wfprocessinstance
1067 | Not applicable | otWFRule | wfrule
1068 | Not applicable | otWFRuleLog | wfrulelog
1069 | Not applicable | otWFStep | wfstep


Error Codes

When you use the Microsoft CRM SDK, you call the APIs through the SOAP interface. The following code sample shows how to catch any errors that occur:

Example

[C#]
catch (System.Web.Services.Protocols.SoapException err)
{
strErrorMsg = ("ErrorMessage: " + err.Message + " " +
err.Detail.OuterXml + " Source: " + err.Source );
}

This code produces the following output when an error occurs (formatting added for readability):

Soap Exception Detail (Detail.OuterXml):
<detail>
<error>
<code>80040220</code>
<description>
The user does not hold the necessary privileges.
</description>
<details>
The caller does not hold the privilege with ID: {A8BFF87F-0DF0-41D4-BABD-F093FAF1E32C}
</details>
</error>
</detail>

The following table lists the error codes returned from Microsoft CRM SDK methods.

Error ID | Hex | Description
IDS_REQUIREDFIELDMISSING | 80040200 | Required field missing.
IDS_INVALID_XML | 80040201 | Invalid XML.
IDS_EMPTY_XML | 80040202 | Empty XML.
IDS_INVALIDARG | 80040203 | Invalid argument.
IDS_INVALID_USERAUTH | 80040204 | Invalid user authentication parameter.
IDS_INVALID_PARENT | 80040205 | Invalid parent object.
IDS_INVALID_PARENTID | 80040206 | Invalid parent ID.
IDS_INVALID_USERID | 80040207 | Invalid user ID.
IDS_INVALID_TEAMID | 80040208 | Invalid team ID.
IDS_INVALID_BUSINESSID | 80040209 | Invalid business unit ID.
IDS_INVALID_ORGID | 8004020A | Invalid organization ID.
IDS_INVALID_ITEMID | 8004020B | Invalid item ID.
IDS_INVALID_SHAREEID | 8004020C | Invalid ID for the user or team that is shared.
IDS_INVALID_ACCESSRIGHTS | 8004020D | Invalid access rights.
IDS_INVALID_VISIBILITY | 8004020E | Invalid visibility.
IDS_FAILURE_INITTOKEN | 8004020F | Failure in obtaining user token.
IDS_INVALID_ASSIGNEEID | 80040210 | Invalid assignee ID.
IDS_INVALID_ASSOCIATION | 80040211 | Invalid association.
IDS_INVALID_OWNINGUSER | 80040212 | Item does not have an owning user.
IDS_INVALID_VISIBILITY_MODIFICATION_ACCESS | 80040213 | User does not have access to modify the visibility of this item.
IDS_CANNOT_SHARE_OBJECT_WITH_OWNER | 80040214 | An item cannot be shared with the owning user or a user belonging to the owning team.
IDS_MISSING_OWNER | 80040215 | Item does not have an owner.
IDS_UNEXPECTED | 80040216 | An unexpected error occurred.
IDS_OBJECT_DOES_NOT_EXIST | 80040217 | The specified object was not found.
IDS_INVALID_POINTER | 80040218 | The output pointer was invalid.
IDS_NOT_IMPLEMENTED | 80040219 | The requested functionality is not yet implemented.
IDS_MISSING_BUSINESSID | 8004021A | The business ID is missing.
IDS_MISSING_USERID_OR_TEAMID | 8004021B | The user ID or the team ID is missing.
IDS_PRESENT_USERID_AND_TEAMID | 8004021C | Both the user ID and team ID are present. Only one should be present.
IDS_INVALID_USERID_OR_BUSINESSID_OR_USERS_BUSINESS_INVALID | 8004021D | One of the following occurred: invalid user ID, invalid business unit ID, or the user does not belong to the business unit.
IDS_CANNOT_GRANT_OR_REVOKE_ACCESS_TO_BUSINESS | 8004021E | Cannot grant or revoke access rights to a business unit.
IDS_INVALID_OBJECT_TYPE | 8004021F | Invalid object type.
IDS_PRIVILEGE_DENIED | 80040220 | The user does not hold the necessary privileges.
IDS_CANNOT_ASSIGN_TO_BUSINESS | 80040221 | Cannot assign an object to a business unit.
IDS_OUTOFMEMORY | 80040222 | Out of memory.
IDS_ONLY_OWNER_CAN_REVOKE | 80040223 | Only the owner of an object can revoke the owner's access to that object.
IDS_SERVICE_NOT_RUNNING | 80040224 | The Microsoft CRM Security Service has not been started.
IDS_USER_NOT_ENABLED | 80040225 | The specified user is either disabled or is not a member of any business unit.
IDS_ANONYMOUS_ENABLED | 80040226 | The logged-on user was not found in Active Directory.
IDS_CANNOT_DELETE_OBJECT_BECAUSE_OF_ASSOTIATION | 80040227 | The object you tried to delete is associated with another object and cannot be deleted.
IDS_CANNOT_DELETE_OBJECT_BECAUSE_IT_IS_READ_ONLY | 80040228 | The object cannot be deleted because it is read-only.
IDS_INVALID_OWNERID | 80040229 | The owner ID was invalid.
IDS_AD_OBJECT_ALREADY_EXISTS | 8004022A | An object with the specified name already exists in Active Directory.
IDS_OWNER_NOT_ENABLED | 8004022B | The specified owner has been disabled.
IDS_DATA_OUTOFRANGE | 8004022C | Data out of range.
IDS_INVALID_CUSTOMER | 8004022D | The customer is invalid.
IDS_CANNOT_UPDATE_OBJECT_BECAUSE_IT_IS_READ_ONLY | 8004022E | The object cannot be updated because it is read-only.
IDS_OPPORTUNITY_DOES_NOT_EXIST | 80040500 | The opportunity does not exist.
IDS_LEAD_DOES_NOT_EXIST | 80040501 | The lead does not exist.
IDS_ACCOUNT_DOES_NOT_EXIST | 80040502 | The account does not exist.
IDS_CONTACT_DOES_NOT_EXIST | 80040503 | The contact does not exist.
IDS_OPPORTUNITY_INVALID_PARENT | 80040504 | The parent of an opportunity must be an account or contact.
IDS_OPPORTUNITY_MISSING_PARENT | 80040505 | The parent of the opportunity is missing.
IDS_ACCOUNT_LOOP_EXISTS | 80040506 | A loop exists in the accounts hierarchy.
IDS_ACCOUNT_LOOP_BEING_CREATED | 80040507 | Creating this parental association would create a loop in the accounts hierarchy.
IDS_PRESENT_PARENTACCOUNT_AND_PARENTCONTACT | 80040508 | You can either specify a contact's parent contact or its account, but not both.
IDS_CONTACT_LOOP_EXISTS | 80040509 | A loop exists in the contacts hierarchy.
IDS_CONTACT_LOOP_BEING_CREATED | 8004050A | Creating this parental association would create a loop in the contacts hierarchy.
IDS_LEAD_NO_PARENT | 8004050B | The lead does not have a parent.
IDS_LEAD_NOT_ASSIGNED | 8004050C | The lead has not been assigned.
IDS_LEAD_USER_CANNOT_REJECT | 8004050D | The user does not have the privilege to reject a lead, so he cannot be assigned the lead for acceptance.
IDS_OPPORTUNITY_ONE_ACCOUNT | 8004050E | An opportunity can be associated with only one account.
IDS_OPPORTUNITY_ORPHAN | 8004050F | Removing this association will make the opportunity an orphan.
IDS_LEAD_ONE_ACCOUNT | 80040510 | A lead can be associated with only one account.
IDS_ACCOUNT_HAS_CHILD_OPPORTUNITIES | 80040511 | The account has child opportunities.
IDS_CONTACT_HAS_CHILD_OPPORTUNITIES | 80040512 | The contact has child opportunities.
IDS_LEAD_NOT_ASSIGNED_TO_CALLER | 80040513 | The lead is not being assigned to the caller for acceptance.
IDS_CUSTOMERADDRESS_TYPE_INVALID | 80040514 | Invalid customer address type.
IDS_OPPORTUNITY_IS_ALREADY_CLOSED | 80040515 | The opportunity is already closed.
IDS_OPPORTUNITY_CANNOT_BE_CLOSED | 80040516 | The opportunity cannot be closed.
IDS_JOURNALING_INVALID_RECIPIENT_TYPE | 80040800 | An invalid recipient type was specified.
IDS_JOURNALING_UNSUPPORTED_OBJECT_TYPE | 80040801 | Unsupported type of objects passed in operation.
IDS_JOURNALING_MISSING_EVENT_DIRECTION | 80040802 | Event direction code is missing.
IDS_JOURNALING_INVALID_EVENT_TYPE | 80040803 | Invalid event type.
IDS_JOURNALING_MISSING_EVENT_TYPE | 80040804 | Event type is missing.
IDS_JOURNALING_MISSING_LEAD_ID | 80040805 | Lead ID is missing.
IDS_JOURNALING_MISSING_ACCOUNT_ID | 80040806 | Account ID is missing.
IDS_JOURNALING_MISSING_OPPORTUNITY_ID | 80040807 | Opportunity ID is missing.
IDS_JOURNALING_MISSING_CONTACT_ID | 80040808 | Contact ID is missing.
IDS_JOURNALING_MISSING_INCIDENT_ID | 80040809 | Incident ID is missing.
IDS_COMMUNICATIONS_NOPARTYADDRESS | 80040B00 | The object address was not found on the party or the party is marked as no e-mail.
IDS_COMMUNICATIONS_BADSENDER | 80040B01 | More than one sender specified.
IDS_COMMUNICATIONS_NOSENDER | 80040B02 | No e-mail address was specified, and the calling user does not have an e-mail address set.
IDS_COMMUNICATIONS_NOMSCRMKEY | 80040B03 | The Microsoft CRM key (mscrm) was not found in the registry.
IDS_COMMUNICATIONS_NOMAILSERVERURL | 80040B04 | The mail server URL was not set in the registry. "HKLM\Software\Microsoft\MSCRM\mailserverurl"
IDS_COMMUNICATIONS_NORECIPIENTS | 80040B05 | At least one system user or queue in the organization must be a recipient.
IDS_COMMUNICATIONS_NOPARTICIPATIONMASK | 80040B06 | The participation type is missing from an activity.
IDS_COMMUNICATIONS_TEMPLATE_INVALIDTEMPLATE | 80040B07 | The template body is invalid.
IDS_COMMUNICATIONS_NOSENDERADDRESS | 80040B08 | The sender does not have an e-mail address on the party record.
IDS_METADATA_NOENTITY | 80040E00 | The specified entity does not exist.
IDS_METADATA_NOMAPPING | 80040E01 | The mapping between specified entities does not exist.
IDS_QUERYBUILDER_INVALIDUPDATE | 80041100 | An attempt was made to update a field that cannot be updated.
IDS_QUERYBUILDER_UNEXPECTED | 80041101 | An unexpected error occurred.
IDS_QUERYBUILDER_NOENTITY | 80041102 | The specified entity was not found.
IDS_QUERYBUILDER_NOATTRIBUTE | 80041103 | The specified attribute does not exist on this entity.
IDS_QUERYBUILDER_NO_PRIMARY_KEY | 80041104 | No primary key was found for the specified entity.
IDS_QUERYBUILDER_MULTI_PRIMARY_KEY | 80041105 | Found an unexpected multiple-column primary key.
IDS_QUERYBUILDER_BAD_CONDITION | 80041106 | Incorrect filter condition or conditions.
IDS_QUERYBUILDER_ATTRIBUTE_WITH_AGGREGATE | 80041107 | Attributes cannot be returned when aggregate operation is specified.
IDS_QUERYBUILDER_INVALID_VALUE | 80041108 | Invalid value specified for type.
IDS_QUERYBUILDER_INVALID_ALIAS | 80041109 | Invalid alias for aggregate operation.
IDS_ROLES_INVALID_ROLE_DATA | 80041400 | The role data is invalid.
IDS_ROLES_INVALID_ROLE_ID | 80041401 | Invalid role ID.
IDS_ROLES_ROLE_DOES_NOT_EXIST | 80041402 | The specified role does not exist.
IDS_ROLES_ROLE_ALREADY_EXISTS | 80041403 | A role with the specified name already exists.
IDS_ROLES_INVALID_TEMPLATE_ID | 80041404 | Invalid role template ID.
IDS_ROLES_MISS_ROLEID | 80041405 | The role ID was unexpectedly missing.
IDS_ROLES_MISS_BUSINESSID | 80041406 | The role's business unit ID was unexpectedly missing.
IDS_ROLES_MISS_ROLE_NAME | 80041407 | The role name was unexpectedly missing.
IDS_ROLES_MISS_PRIVID | 80041408 | The privilege ID was unexpectedly missing.
IDS_ROLES_USER_IN_WRONG_BIZ | 80041409 | The user belongs to a different business unit than the role.
IDS_ROLES_INVALID_ROLE_NAME | 8004140A | The role name is invalid.
IDS_ROLES_INVALID_DEPTH | 8004140B | Invalid privilege depth.
IDS_ROLES_DELETE_NONPARENT_ROLE | 8004140C | Cannot delete a role that is inherited from a parent business.
IDS_NOTES_NOTE_DOES_NOT_EXIST | 80041700 | The specified note does not exist.
IDS_NOTES_ALREADY_ATTACHED | 80041701 | The specified note is already attached to an object.
IDS_NOTES_LOOP_EXISTS | 80041702 | A loop exists in the annotation hierarchy.
IDS_NOTES_LOOP_BEING_CREATED | 80041703 | Creating this parental association would create a loop in the annotation hierarchy.
IDS_NOTES_NO_ATTACHMENT | 80041704 | The specified note has no attachments.
IDS_XML_INVALID_ENTITY_NAME | 80041A00 | The entity name specified is incorrect.
IDS_XML_INVALID_CREATE | 80041A01 | A field that is not valid for create was specified.
IDS_XML_INVALID_UPDATE | 80041A02 | A field that is not valid for update was specified.
IDS_XML_INVALID_COLLECTION_NAME | 80041A03 | The collection name specified is incorrect.
IDS_XML_PARSE_ERROR | 80041A04 | A parse error was encountered in the XML.
IDS_XML_UNEXPECTED | 80041A05 | An unexpected error has occurred.
IDS_XML_INVALID_ENTITY_ATTRIBUTES | 80041A06 | Invalid attributes.
IDS_XML_INVALID_FIELD | 80041A07 | An invalid value was passed in for a field.
IDS_XML_INVALID_READ | 80041A08 | A field that is not valid for read was specified.
IDS_BIZMGMT_MISS_BUSINESS_NAME | 80041D00 | The business name was unexpectedly missing.
IDS_BIZMGMT_MISS_USER_DOMAINNAME | 80041D01 | The user's domain name was unexpectedly missing.
IDS_BIZMGMT_MISS_PARENT_BUSINESS | 80041D02 | The parent business was unexpectedly missing.
IDS_BIZMGMT_DEFAULTUSER_NOT_IN_BUSINESS | 80041D03 | The default user is not in the business.
IDS_BIZMGMT_BUSINESS_PARENT_DIFF_MERCHANT | 80041D04 | The business unit is not in the same merchant as the parent business unit.
IDS_BIZMGMT_USER_CAN_NOT_BE_OWN_PARENT | 80041D06 | The user cannot be its own parent user.
IDS_BIZMGMT_USER_NOT_IN_PARENT_HIERARCHY | 80041D07 | The user is not in the parent user's business unit hierarchy.
IDS_BIZMGMT_MISS_TEAM_CAPTAIN | 80041D08 | The team captain ID was unexpectedly missing.
IDS_BIZMGMT_MISS_TEAM_BUSINESS | 80041D09 | The team business unit ID was unexpectedly missing.
IDS_BIZMGMT_TEAM_CAPTAIN_IN_DIFF_MERCHANT | 80041D0A | The team captain is not in the same merchant as the team business unit.
IDS_BIZMGMT_MISS_TEAM_NAME | 80041D0B | The team name was unexpectedly missing.
IDS_BIZMGMT_TEAM_PARENT_DIFF_MERCHANT | 80041D0C | The team is not in the same merchant as the parent business unit.
IDS_BIZMGMT_CAN_NOT_REMOVE_TEAM_CAPTAIN | 80041D0D | The team captain cannot be removed.
IDS_BIZMGMT_MISS_PRIMARY_BUSINESS | 80041D0E | The partnership primary business unit was unexpectedly missing.
IDS_BIZMGMT_MISS_PARTNER_BUSINESS | 80041D0F | The partnership partner business unit was unexpectedly missing.
IDS_BIZMGMT_PRIMARY_SAME_AS_PARTNER | 80041D10 | The primary business unit is the same as the partner business unit.
IDS_BIZMGMT_PARTNERSHIP_ALREADY_EXISTS | 80041D11 | A partnership between the specified primary business unit and partner business unit already exists.
IDS_BIZMGMT_CALLER_NOT_IN_PRIMARY_BUSINESS | 80041D12 | The caller is not from the primary business unit.
IDS_BIZMGMT_DEFAULTUSER_NOT_IN_PRIMARY_BUSINESS | 80041D13 | The default user is not from the primary business unit.
IDS_BIZMGMT_CALLER_NOT_IN_PARTNER_BUSINESS | 80041D14 | The caller is not from the partner business unit.
IDS_BIZMGMT_DEFAULTUSER_NOT_IN_PARTNER_BUSINESS | 80041D15 | The default user is not from the partner business unit.
IDS_BIZMGMT_PARTNERSHIP_NOT_IN_PENDING_STATUS | 80041D16 | The partnership has been accepted or declined.
IDS_BIZMGMT_CAN_NOT_REMOVE_PARTNERSHIP_DEFAULTUSER | 80041D17 | The default user of a partnership cannot be removed.
IDS_BIZMGMT_CAN_NOT_DELETE_BUSINESS | 80041D18 | This is a sub-business. Use IBizMerchant::Delete to delete a sub-business.
IDS_BIZMGMT_CAN_NOT_DELETE_PROVISION | 80041D19 | This is a provisioned root business. Use IBizProvision::Delete to delete this root business.
IDS_BIZMGMT_CAN_NOT_DISABLE_BUSINESS | 80041D1A | This is a sub-business. Use IBizMerchant::Disable to disable this sub-business.
IDS_BIZMGMT_CAN_NOT_DISABLE_PROVISION | 80041D1B | This is a provisioned root business. Use IBizProvision::Disable to disable this root business.
IDS_BIZMGMT_CAN_NOT_ENABLE_BUSINESS | 80041D1C | This is a sub-business. Use IBizMerchant::Enable to enable this sub-business.
IDS_BIZMGMT_CAN_NOT_ENABLE_PROVISION | 80041D1D | This is a provisioned root business. Use IBizProvision::Enable to enable this root business.
IDS_BIZMGMT_USER_DOES_NOT_HAVE_PARENT | 80041D1E | This user does not have a parent user.
IDS_BIZMGMT_INVALID_USERID | 80041D1F | The user ID is invalid.
IDS_BIZMGMT_BUSINESS_LOOP_EXISTS | 80041D20 | Loop exists in the business hierarchy.
IDS_BIZMGMT_BUSINESS_LOOP_BEING_CREATED | 80041D21 | Creating this parental association would create a loop in the business hierarchy.
IDS_BIZMGMT_CHILDBUSINESS_DOES_NOT_EXIST | 80041D22 | The child business unit ID is invalid.
IDS_BIZMGMT_PARENTBUSINESS_DOES_NOT_EXIST | 80041D23 | The parent business unit ID is invalid.
IDS_BIZMGMT_USER_LOOP_EXISTS | 80041D24 | Loop exists in the user hierarchy.
IDS_BIZMGMT_USER_LOOP_BEING_CREATED | 80041D25 | Creating this parental association would create a loop in the user hierarchy.
IDS_BIZMGMT_CHILDUSER_DOES_NOT_EXIST | 80041D26 | The child user ID is invalid.
IDS_BIZMGMT_PARENTUSER_DOES_NOT_EXIST | 80041D27 | The parent user ID is invalid.
IDS_BIZMGMT_CAN_NOT_MOVE_ROOT_TEAM_CAPTAIN | 80041D28 | The captain of the root business unit's team cannot be moved.
IDS_BIZMGMT_NO_PARENTBUSINESS | 80041D29 | The specified business unit does not have a parent business.
IDS_BIZMGMT_USER_NOT_IN_ACTIVEDIRECTORY | 80041D2A | The user does not exist in Active Directory.
IDS_BIZMGMT_USER_SETTINGS_NOT_CREATED | 80041D2B | The specified user's settings have not yet been created.
IDS_BIZMGMT_USER_ALREADY_EXISTS | 80041D2C | The specified Active Directory user already exists as a Microsoft CRM user.
IDS_BIZMGMT_CANNOT_READ_ACCOUNT_CONTROL | 80041D2D | Insufficient permissions to the specified Active Directory user. Contact your system administrator.
IDS_PROPBAG_PROPERTY_NOT_FOUND | 80042000 | The specified property was not found in the property bag.
IDS_PROPBAG_NO_INTERFACE | 80042001 | The property bag interface could not be found.
IDS_PROPBAG_NULL_PROPERTY | 80042002 | The specified property was null in the property bag.
IDS_PROPBAGCOLL_OUT_OF_RANGE | 8004201E | The bag index in the collection was out of range.
IDS_RSPROPBAG_DBINFO_NOT_SET | 8004203C | The database information for the recordset property bag has not been set.
IDS_RSPROPBAG_DBINFO_ALREADY_SET | 8004203D | The database information for the recordset property bag has already been set.
IDS_PROPBAG_ATTRIBUTE_NOT_NULLABLE | 8004203E | One of the attributes passed cannot be NULL.
IDS_DATAACCESS_UNEXPECTED | 80042300 | Unexpected error in data access. The database connection may not have been opened successfully.
IDS_WORKFLOW_PROCESS_INSTANCE_IS_NOT_ACTIVE | 80042600 | Workflow process instance is terminated.
IDS_WORKFLOW_PROPERTY_NOT_FOUND | 80042601 | Expression property not found.
IDS_WORKFLOW_PROCESS_INSTANCE_IS_NOT_COMPLETE | 80042602 | Workflow process instance is not terminated.
IDS_WORKFLOW_RUNNING_INSTANCES_EXIST | 80042603 | There are still running instances for this process.
IDS_WORKFLOW_PROCESS_IS_ACTIVE | 80042604 | The process is activated. You cannot update an activated process.
IDS_WORKFLOW_PROCESS_NOT_ACTIVE | 80042605 | The process is not activated.
IDS_WORKFLOW_CANNOT_CLONE_FORUPDATE | 80042606 | Cannot clone a process for update if the process has not been put in production.
IDS_WORKFLOW_PROCESS_CANNOT_DELETE_INIT_STEP | 80042607 | Cannot delete the initial step of the process.
IDS_WORKFLOW_ILLEGAL_CONDITIONID_IN_ACTION_PARAMETER | 80042608 | Action parameter cannot contain a condition ID.
IDS_WORKFLOW_ILLEGAL_ACTIONID_IN_CONDITION_PARAMETER | 80042609 | Condition parameter cannot contain an action ID.
IDS_WORKFLOW_INVALID_EVENTYPECODE | 8004260A | Invalid event type code.
IDS_WORKFLOW_PARAMETER_INVALID_REFACTIONID | 8004260D | Invalid refactionid. The refactionid does not point to a defined action in the process.
IDS_WORKFLOW_MISSING_PARAMETERTYPE | 8004260E | Missing parameter type.
IDS_WORKFLOW_INVALID_PARAMETERTYPE | 8004260F | Invalid parameter type.
IDS_WORKFLOW_INVALID_DATATYPE | 80042610 | Invalid data type.
IDS_WORKFLOW_MISSING_CONDITIONTYPE | 80042611 | Missing condition type code.
IDS_WORKFLOW_INVALID_CONDITIONTYPE | 80042612 | Invalid condition type.
IDS_WORKFLOW_MISSING_RULETYPE | 80042613 | Missing rule type.
IDS_WORKFLOW_INVALID_RULETYPE | 80042614 | Invalid rule type.
IDS_WORKFLOW_INVALID_NEXTSTEPID | 80042616 | Invalid nextstepid. The nextstepid does not point to a defined step in the process.
IDS_WORKFLOW_PARAMETER_MISSING_VALUE | 80042618 | Value missed in parameter.
IDS_WORKFLOW_PARAMETER_MISSING_ATTRIBUTEID | 80042619 | AttributeId missed in parameter.
IDS_WORKFLOW_PARAMETER_MISSING_REFACTIONID | 8004261C | RefActionId missed in parameter.
IDS_WORKFLOW_ONLY_ONE_ACTIVE_PROCESS | 8004261D | Only one active process allowed for each entity type.
IDS_WORKFLOW_MISSING_ENTITYTYPE | 8004261E | Missing entitytype.
IDS_WORKFLOW_INVALID_ENTITYTYPE | 8004261F | Invalid entitytype in the XML.
IDS_WORKFLOW_MISSING_PROCESSTYPECODE | 80042620 | Missing processtypecode in the XML.
IDS_WORKFLOW_INVALID_PROCESSTYPECODE | 80042621 | Invalid processtypecode in the XML.
IDS_WORKFLOW_ILLEGAL_NEXTSTEPID | 80042622 | Illegal nextstepid. Either nextstepid is not compatible with rule type, or rule type is missed.
IDS_WORKFLOW_PARAMETER_ILLEGAL_VALUE | 80042628 | Parameter value is not valid. Either setting parameter value is not compatible with parameter type, or parameter type is missing.
IDS_WORKFLOW_PARAMETER_ILLEGAL_ATTRIBUTEID | 80042629 | Parameter attributeid is not valid. Either setting parameter attributeid is not compatible with parameter type, or parameter type is missed.
IDS_WORKFLOW_PARAMETER_ILLEGAL_REFACTIONID | 8004262C | Parameter refactionid is not valid. Either setting parameter refactionid is not compatible with parameter type, or parameter type is missed.
IDS_WORKFLOW_PARAMETER_MISSING_NEXTSTEPID | 8004262D | Missing nextstepid.
IDS_WORKFLOW_PARAMETER_INVALID_PARENTID | 8004262E | Invalid parentid. The parameter parentid does not point to a defined parameter for the same condition or action.
IDS_WORKFLOW_PARAMETER_MISSING_OBJECTID | 8004262F | ObjectId missing in parameter.
IDS_WORKFLOW_PARAMETER_ILLEGAL_OBJECTID | 80042630 | Parameter ObjectId is not valid. Either setting parameter objectid is not compatible with parameter type, or parameter type is missed.
IDS_WORKFLOW_MISSING_EVENTTYPECODE | 80042631 | Missing event type code.
IDS_WORKFLOW_MISSING_ACTIONTYPECODE | 80042632 | Missing action type code.
IDS_WORKFLOW_INVALID_ACTIONTYPECODE | 80042633 | Invalid action type code.
IDS_WORKFLOW_MISSING_CONDITIONID_IN_CONDITION_PARAMETER | 80042634 | Missing conditionid in condition parameter.
IDS_WORKFLOW_MISSING_ACTIONID_IN_ACTION_PARAMETER | 80042635 | Missing actionid in action parameter.
IDS_WORKFLOW_CANNOT_ACTIVATE_PROCESS_TEMPLATE | 80042636 | Cannot activate/deactivate a process template.
IDS_WORKFLOW_ONLY_ONE_ACTIVE_SALES_PROCESS | 80042637 | Only one active sales process allowed.
IDS_WORKFLOW_CANNOT_DEACTIVATE_PROCESS_TEMPLATE | 80042638 | Cannot activate/deactivate a process template.
IDS_WORKFLOW_MISSING_INITIALSTEPID | 80042639 | Missing initialstepid.
IDS_WORKFLOW_INVALID_INITIALSTEPID | 8004263A | Invalid initialstepid.
IDS_WORKFLOW_MISSING_USERCONTEXT | 8004263B | Missing user context.
IDS_WORKFLOW_FAILED_LAUNCH_PROCESS | 8004263C | Failed to start process.
IDS_WORKFLOW_PROCESS_INSTANCE_NOT_IDS_WORKFLOW_EXIST | 8004263D | Process instance does not exist.
IDS_WORKFLOW_ACTION_INVALID_STEPID | 8004263E | Action has an invalid step ID.
IDS_WORKFLOW_RULE_INVALID_STEPID | 8004263F | Rule has an invalid step ID.
IDS_WORKFLOW_CONDITION_INVALID_RULEID | 80042640 | Condition has an invalid rule ID.
IDS_WORKFLOW_PARAMETER_INVALID_ACTIONID | 80042641 | Parameter has an invalid action ID.
IDS_WORKFLOW_PARAMETER_INVALID_CONDITIONID | 80042642 | Parameter has an invalid condition ID.
IDS_WORKFLOW_MORE_THAN_ONE_OBJECT_PROCESS_INSTANCE | 80042643 | Cannot start the object process because another object process instance has already run.
IDS_CP_USER_DOES_NOT_EXIST | 80042900 | The customer portal user does not exist, or the password was incorrect.
IDS_CP_BAD_PASSWORD | 80042901 | Incorrect password for the specified customer portal user.
IDS_CP_ENCRYPT_FAILED | 80042902 | Encryption of the supplied password failed.
IDS_CP_DECRYPT_FAILED | 80042903 | Decryption of the password failed.
IDS_EVAL_UPDATE_SHOULD_HAVE_3_PARAMETERS | 80042C00 | Update action should have 3 parameters.
IDS_EVAL_ASSIGN_SHOULD_HAVE_4_PARAMETERS | 80042C01 | Assign action should have 4 parameters.
IDS_EVAL_ALLABORTED | 80042C02 | Evaluation aborted and further processing has been stopped.
IDS_EVAL_ABORTED | 80042C03 | Evaluation aborted and further processing has been stopped.
IDS_EVAL_COMPLETED | 80042C04 | Evaluation completed.
IDS_EVAL_OBJECT_NOT_FOUND | 80042C05 | The required object does not exist.
IDS_EVAL_PROPERTY_NOT_FOUND | 80042C06 | The required property of the object was not found.
IDS_EVAL_METABASE_ENTITY_COMPOUND_KEYS | 80042C07 | The specified metabase object has compound keys. Compound-key entities are not currently supported.
IDS_EVAL_METABASE_ATTRIBUTE_NOT_FOUND | 80042C08 | The specified metabase attribute does not exist.
IDS_EVAL_PROPERTY_IS_NULL | 80042C09 | The required property of the object was not set.
IDS_EVAL_METABASE_ENTITY_NOT_MATCH_QUERY | 80042C0A | The specified refentityid does not match the query for a WFPM_SELECT parameter.
IDS_EVAL_METABASE_ATTRIBUTE_NOT_MATCH_QUERY | 80042C0B | The specified refattributeid does not match the query for a WFPM_SELECT parameter.
IDS_EVAL_ALLCOMPLETED | 80042C0C | Evaluation completed and further processing has been stopped.
IDS_EVAL_CHANGE_TYPE_ERROR | 80042C0D | Change type error.
IDS_EVAL_MISS_SELECT_QUERY | 80042C0E | Missing the query sub-parameter in a select parameter.
IDS_EVAL_ERROR_ADD_PARAMETER | 80042C0F | An error occurred when evaluating a WFPM_ADD parameter.
IDS_EVAL_ERROR_SUBTRACTION_PARAMETER | 80042C10 | An error occurred when evaluating a WFPM_SUBTRACTION parameter.
IDS_EVAL_ERROR_MULTIPLICATION_PARAMETER | 80042C11 | An error occurred when evaluating a WFPM_MULTIPLICATION parameter.
IDS_EVAL_ERROR_DIVISION_PARAMETERS | 80042C12 | Division parameter can have only two sub-parameters.
IDS_EVAL_ERROR_DIVISION_PARAMETER | 80042C13 | An error occurred when evaluating a WFPM_DIVISION parameter.
IDS_EVAL_ERROR_MODULUS_PARAMETERS | 80042C14 | Modulus parameter can have only two sub-parameters.
IDS_EVAL_ERROR_MODULUS_PARAMETER | 80042C15 | An error occurred when evaluating a WFPM_MODULUS parameter.
IDS_EVAL_ERROR_DIVIDED_BY_ZERO | 80042C16 | Divided by zero.
IDS_EVAL_ERROR_CREATE_ACTIVITY | 80042C17 | Error in action create activity.
IDS_EVAL_ERROR_ACTIVITY_ATTACHMENT | 80042C18 | Error in action activity attachment.
IDS_EVAL_ERROR_HANDLE_ACTIVITY | 80042C19 | Error in action handle activity.
IDS_EVAL_ERROR_UNHANDLE_ACTIVITY | 80042C1A | Error in action unhandle activity.
IDS_EVAL_ERROR_CREATE_NOTE | 80042C1B | Error in action create note.
IDS_EVAL_ERROR_NOTE_ATTACHMENT | 80042C1C | Error in action note attachment.
IDS_EVAL_ERROR_CREATE_INCIDENT | 80042C1D | Error in action create incident.
IDS_EVAL_ERROR_HANDLE_INCIDENT | 80042C1E | Error in action handle incident.
IDS_EVAL_ERROR_UNHANDLE_INCIDENT | 80042C1F | Error in action unhandle incident.
IDS_EVAL_ERROR_SEND_EMAIL | 80042C20 | Error in action send e-mail.
IDS_EVAL_ERROR_EMAIL_TEMPLATE | 80042C21 | Error in action e-mail template.
IDS_EVAL_ERROR_ASSIGN | 80042C22 | Error in action assign.
IDS_EVAL_ERROR_UPDATE | 80042C23 | Error in action update.
IDS_EVAL_ERROR_ROUTE | 80042C24 | Error in action route.
IDS_EVAL_ERROR_SETSTATE | 80042C25 | Error in action set state.
IDS_EVAL_ERROR_POSTURL | 80042C26 | Error in action post URL.
IDS_EVAL_ERROR_EXEC | 80042C27 | Error in action execute.
IDS_EVAL_ERROR_HALT | 80042C28 | Error in action halt.
IDS_EVAL_ERROR_INCIDENT_QUEUE | 80042C29 | Failed to evaluate INCIDENT_QUEUE.
IDS_EVAL_GENERIC_ERROR | 80042C2A | Evaluation error.
IDS_EVAL_ERROR_INVALID_PARAMETER | 80042C2B | Invalid parameter.
IDS_EVAL_ERROR_ABS_PARAMETER | 80042C2C | An error occurred when evaluating a WFPM_ABS parameter.
IDS_EVAL_ERROR_GT_PARAMETER | 80042C2D | An error occurred when evaluating a WFPM_GT parameter.
IDS_EVAL_ERROR_GE_PARAMETER | 80042C2E | An error occurred when evaluating a WFPM_GE parameter.
IDS_EVAL_ERROR_LT_PARAMETER | 80042C2F | An error occurred when evaluating a WFPM_LT parameter.
IDS_EVAL_ERROR_LE_PARAMETER | 80042C30 | An error occurred when evaluating a WFPM_LE parameter.
IDS_EVAL_ERROR_EQ_PARAMETER | 80042C31 | An error occurred when evaluating a WFPM_EQ parameter.
IDS_EVAL_ERROR_NE_PARAMETER | 80042C32 | An error occurred when evaluating a WFPM_NE parameter.
IDS_EVAL_ERROR_BETWEEN_PARAMETER | 80042C33 | An error occurred when evaluating a WFPM_BETWEEN parameter.
IDS_EVAL_ERROR_IN_PARAMETER | 80042C34 | An error occurred when evaluating a WFPM_IN parameter.
IDS_EVAL_ERROR_INVALID_RECIPIENT | 80042C35 | Invalid e-mail recipient.
IDS_EVAL_ERROR_SUBSTR_PARAMETER | 80042C36 | Error occurred when evaluating a WFPM_SUBSTR parameter.
IDS_EVAL_ERROR_STRLEN_PARAMETER | 80042C37 | Error occurred when evaluating a WFPM_STRLEN parameter.
IDS_EVAL_ERROR_BEGIN_WITH_PARAMETER | 80042C38 | Error occurred when evaluating a WFPM_BEGIN_WITH parameter.
IDS_EVAL_ERROR_END_WITH_PARAMETER | 80042C39 | Error occurred when evaluating a WFPM_END_WITH parameter.
IDS_EVAL_ERROR_CONTAIN_PARAMETER | 80042C3A | Error occurred when evaluating a WFPM_CONTAIN parameter.
IDS_LICENSE_INVALID_LICENSE | 80042F00 | The specified license type is invalid.
IDS_LICENSE_USER_RETRIEVE_FAILED | 80042F01 | Failed while retrieving user license information. Most likely a database error.
IDS_LICENSE_INVALID_FOR_USER | 80042F02 | The specified license is invalid for the user. There is a license conflict or the user has already been granted the license.
IDS_LICENSE_ID_RETRIEVE_FAILED | 80042F03 | Failed while retrieving the license ID. Most likely a database error.
IDS_LICENSE_NO_USER_LICENSE | 80042F04 | The specified license is not granted to the user.
IDS_LICENSE_ORG_RETRIEVE_FAILED | 80042F05 | Failed while retrieving organization license information. Most likely a database error.
IDS_LICENSE_INVALID_FOR_ORG | 80042F06 | The specified license is invalid for the organization. There is a license conflict or the organization has already been granted the license.
IDS_LICENSE_CANNOT_DELETE | 80042F07 | The license cannot be deleted. It is in use by one or more members of the organization.
IDS_LICENSE_INVALID_LICENSEKEY | 80042F08 | The license key is invalid.
IDS_LICENSE_NO_LICENSES | 80042F09 | The user has not been granted any licenses or the user has not been assigned any roles.
IDS_LICENSE_TOO_MANY_USERS | 80042F0A | The maximum number of users for this license has been reached.
IDS_LICENSE_INVALID_DEPLOYMENT | 80042F0B | The deployment has more licenses granted than were purchased.
IDS_LICENSE_WRONG_ORG | 80042F0C | Cannot retrieve license information for other organizations.
IDS_TIMEBOMB_EXPIRED | 80042F0D | The evaluation period for Microsoft CRM Beta has expired.
IDS_LICENSE_DOES_NOT_EXIST | 80042F0E | The specified license does not exist for this organization.
IDS_LICENSE_INVALID_UPGRADE_TYPE | 80042F0F | Cannot upgrade to specified license type.
IDS_LICENSE_INVALID_UPGRADE_COUNT | 80042F10 | Not enough licenses purchased to upgrade.
IDS_LICENSE_INVALID_VERSION | 80042F11 | License key has an invalid version number.
IDS_CONTRACT_UNEXPECTED | 80043200 | An unexpected error occurred in Contracts.
IDS_CONTRACT_ACCOUNTMISSING | 80043201 | Account is required to save a contract.
IDS_CONTRACT_INVALIDSTARTENDDATE | 80043202 | Start date/end date or billing start date/billing end date is invalid.
IDS_CONTRACT_INVALIDSTATE | 80043203 | The state of the contract is invalid.
IDS_CONTRACT_LINE_INVALIDSTATE | 80043204 | The state of the contract line item is invalid.
IDS_CONTRACT_INVALIDALLOTMENTTYPECODE | 80043205 | The allotment type code is invalid.
IDS_CONTRACT_TEMPLATE_DOES_NOT_EXIST | 80043206 | The contract template does not exist.
IDS_CONTRACT_DOES_NOT_EXIST | 80043207 | The contract does not exist.
IDS_CONTRACT_LINEITEM_DOES_NOT_EXIST | 80043208 | The contract line item does not exist.
IDS_CONTRACT_INVALIDDATETIME | 80043209 | The date/time is invalid.
IDS_CONTRACT_OPENCASESEXIST | 8004320A | There are open cases against this contract line item.
IDS_CONTRACT_TEMPLATE_NOABBREVIATION | 8004320B | Abbreviation cannot be NULL.
IDS_CONTRACT_NOLINEITEMS | 8004320C | There are no contract line items for this contract.
IDS_CONTRACT_INVALID_CUSTOMER | 8004320D | The customer of the contract is invalid.
IDS_CONTRACT_INVALID_SERVICE_ADDRESS | 8004320E | The service address of the contract is invalid.
IDS_CONTRACT_INVALID_BILLTO_ADDRESS | 8004320F | The bill-to address of the contract is invalid.
IDS_CONTRACT_INVALID_BILLTO_CUSTOMER | 80043210 | The bill-to customer of the contract is invalid.
IDS_CONTRACT_INVALID_CONTRACTTEMPLATE | 80043211 | The contract template is invalid.
IDS_CONTRACT_INVALID_OWNER | 80043212 | The owner of the contract is invalid.
IDS_CONTRACT_INVALID_CONTRACT | 80043213 | The contract is invalid.
IDS_CONTRACT_INVALID_TOTALALLOTMENTS | 80043214 | The totalallotments is invalid.
IDS_CONTRACT_INVALID_PRICE | 80043215 | The price is invalid.
IDS_CONTRACT_TEMPLATE_ABBREVIATIONEXISTS | 80043216 | The value for abbreviation already exists.
IDS_CONTRACT_INVALIDSTARTDATEFORRENEWEDCONTRACT | 80043217 | The start date of the renewed contract cannot be earlier than the end date of the originating contract.
IDS_CONTRACT_INVALIDSTARTENDDATESFORRENEWEDCONTRACT | 80043218 | The start date/end date of this renewed contract cannot overlap with any other invoiced/active contracts with the same contract number.
IDS_ACTIVITY_INVALID_STATE | 80043500 | Invalid activity state.
IDS_ACTIVITY_INVALID_TYPE | 80043501 | Invalid activity type code.
IDS_ACTIVITY_OBJECT_ID_OR_TYPE_MISSING | 80043502 | Activity regarding object ID or type is missing.
IDS_ACTIVITY_INVALID_OBJECT_TYPE | 80043503 | Activity regarding object type is invalid.
IDS_ACTIVITY_PARTY_OBJECT_ID_OR_TYPE_MISSING | 80043504 | Activity party object ID or type is missing.
IDS_ACTIVITY_INVALID_PARTY_OBJECT_TYPE | 80043505 | Activity party object type is invalid.
IDS_ACTIVITY_PARTY_OBJECT_TYPE_NOT_ALLOWED | 80043506 | Cannot create activity party of specified object type.
IDS_ACTIVITY_INVALID_REGARDING_OBJECT | 80043507 | Invalid activity regarding object; it probably does not exist.
IDS_ACTIVITY_INVALID_TIME_FORMAT | 80043508 | Invalid activity time; check format.
IDS_ACTIVITY_INVALID_DURATION | 80043509 | Invalid activity duration.
IDS_ACTIVITY_DURATION_DOES_NOT_MATCH | 8004350A | Activity duration does not match start/end time.
IDS_ACTIVITY_NOT_ROUTABLE | 8004350B | This type of activity is not routable.
IDS_SALESPEOPLE_EMPTY_SALESPERSON | 80043800 | Parent salesperson cannot be empty.
IDS_SALESPEOPLE_EMPTY_EFFECTIVEDATE | 80043801 | Fiscal calendar effective date cannot be empty.
IDS_SALESPEOPLE_DUPLICATE_CALENDAR_FOUND | 80043802 | Duplicate fiscal calendars found for this salesperson/year.
IDS_SALESPEOPLE_DUPLICATE_CALENDAR_NOT_ALLOWED | 80043803 | Fiscal calendar already exists for this salesperson/year.
IDS_SALESPEOPLE_INVALID_TERRITORY_OBJECT_TYPE | 80043804 | Territories cannot be retrieved by this kind of object.
IDS_SALESPEOPLE_MANAGER_NOT_ALLOWED | 80043805 | Territory manager cannot belong to other territory.
IDS_SALESPEOPLE_TERRITORY_NOT_EMPTY | 80043806 | There are users assigned to this territory.
IDS_SALESPEOPLE_INVALID_FISCALPERIOD_INDEX | 80043807 | Invalid fiscal period index.
IDS_SALESPEOPLE_INVALID_FISCALCALENDAR_TYPE | 80043808 | Invalid fiscal calendar type.
IDS_LOW_QUANTITY_LESS_THAN_ZERO | 80043B00 | The low quantity should be greater than zero.
IDS_LOW_QUANTITY_GREATER_THAN_HIGH_QUANTITY | 80043B01 | The low quantity should be less than high quantity.
IDS_DISCOUNT_RANGE_OVERLAP | 80043B02 | The new quantities overlap the range covered by existing quantities.
IDS_BASE_UNIT_NOT_DELETABLE | 80043B03 | The base unit of a schedule cannot be deleted.
IDS_CANNOT_DEACTIVATE_PRICE_LEVEL | 80043B04 | The price list cannot be deactivated because it is the default price list of an account, contact, or product.
IDS_PRODUCT_NOPRODUCTNUMBER | 80043B05 | The product number cannot be null.
IDS_PRODUCT_PRODUCTNUMBEREXISTS | 80043B06 | The product number already exists.
IDS_PRODUCT_INVALID_QUANTITY_DECIMAL | 80043B07 | The number of decimal places on the quantity is invalid.
IDS_DUPLICATE_PRODUCT_PRICE_LEVEL | 80043B08 | This product and unit combination has a price for this price list.
IDS_PARENT_READ_ONLY | 80043B09 | The parent is read-only and cannot be edited.
IDS_MISSING_UOMSCHEDULEID | 80043B0A | The unit schedule ID is missing.
IDS_INVALID_BASE_UNIT | 80043B0B | The base unit does not belong to the schedule.
IDS_SUBJECT_LOOP_EXISTS | 80043E00 | A loop exists in the subject hierarchy.
IDS_SUBJECT_LOOP_BEING_CREATED | 80043E01 | Creating this parental association would create a loop in the subject hierarchy.
IDS_SUBJECT_DOES_NOT_EXIST | 80043E02 | The subject does not exist.
IDS_QUEUE_MISSING_BUSINESSUNITID | 80043E03 | Missing businessunitid.
IDS_QUEUE_ORGANIZATION_NOT_MATCH | 80043E04 | The callers' organization ID does not match the business unit's organization ID.
IDS_ARTICLE_TEMPLATE_CONTAINS_ARTICLES | 80043E05 | Cannot change the Knowledge Base article template because there are knowledge base articles using it.
IDS_RCSYNC_INVALID_SYNCTIME | 80044100 | The specified synchronization time is invalid. Synchronization times must not be earlier than those returned by the previous synchronization. Please reinitialize your subscription.
IDS_RCSYNC_MSXML_FAILED | 80044101 | [No error message specified.]
IDS_RCSYNC_SOAP_GEN_FAILED | 80044102 | [No error message specified.]
IDS_RCSYNC_SOAP_CONN_FAILED | 80044103 | [No error message specified.]
IDS_RCSYNC_SOAP_SEND_FAILED | 80044104 | [No error message specified.]
IDS_RCSYNC_SOAP_SERVER_ERROR | 80044105 | [No error message specified.]
IDS_RCSYNC_SOAP_FAULT_ERROR | 80044106 | [No error message specified.]
IDS_RCSYNC_SOAP_READ_ERROR | 80044107 | [No error message specified.]
IDS_RCSYNC_SOAP_PARSE_ERROR | 80044108 | [No error message specified.]
IDS_RCSYNC_INVALID_SUBSCRIPTION | 80044109 | The specified subscription does not exist.
IDS_RCSYNC_SUBSCRIPTION_OWNER | 8004410A | The caller ID does not match the subscription owner ID. Only subscription owners may perform subscription operations.
IDS_RCSYNC_SQL_STOPPED_ERROR | 8004410B | [No error message specified.]
IDS_RCSYNC_SQL_PAUSED_ERROR | 8004410c | [No error message specified.]
IDS_INCIDENT_INVALID_CONTRACT_STATE_FOR_CREATE | 80044400 | The case cannot be created against this contract because of the contract state.
IDS_INCIDENT_MISSING_CONTRACT_DETAIL | 80044401 | The contract detail ID is missing.
IDS_INCIDENT_CONTRACT_DETAIL_DOES_NOT_MATCH_CONTRACT | 80044402 | The contract line item is not in the specified contract.
IDS_INCIDENT_CONTRACT_DOES_NOT_HAVE_ALLOTMENTS | 80044403 | The contract does not have enough allotments. The case cannot be created against this contract.
IDS_INCIDENT_INVALID_STATE | 80044404 | Incident state is invalid.
IDS_INCIDENT_ASSOCIATED_ACTIVITY_CORRUPTED | 80044405 | The activity associated with this case is corrupted.
IDS_INCIDENT_INVALID_ACTIVITYTYPECODE | 80044406 | The activitytypecode is invalid.
IDS_INCIDENT_NULL_ACTIVITYTYPECODE | 80044407 | The activitytypecode can't be NULL.
IDS_INCIDENT_MISSING_ACTIVITY_OBJECTTYPE | 80044408 | Missing object type code.
IDS_INCIDENT_MISSING_ACITIVTY_REGARDING_OBJECT | 80044409 | The incident ID is missing.
IDS_INCIDENT_CANNOT_CLOSE | 8004440A | The case cannot be closed because there are open activities for this case.
IDS_INCIDENT_INVALID_ALLOTMENT_TYPE | 8004440B | The allotment type for the contract is invalid.
IDS_INCIDENT_NULL_SPENT_TIME | 8004440C | The timespent can't be NULL.
IDS_INCIDENT_INVALID_CONTRACT_LINE_STATE_FOR_CREATE | 8004440D | The case cannot be created against this contract line item because the contract line item is canceled or expired.
IDS_INCIDENT_CANNOT_CANCEL | 8004440E | The case cannot be canceled because there are open activities for this case.
IDS_INCIDENT_PARENTACCOUNT_AND_PARENTCONTACT_PRESENT | 8004440F | You can either specify a parent contact or account, but not both.
IDS_INCIDENT_PARENTACCOUNT_AND_PARENTCONTACT_NOT_PRESENT | 88044410 | You should specify a parent contact or account.
IDS_CUSTOMIZATION_TRANSFORMATION_NOTSUPPORTED | 80044700 | Transformation is not supported for this object.
IDS_ATTACHMENT_CANNOT_OPEN_TEMPFILE |  | Cannot open temporary attachment file.
IDS_ATTACHMENT_CANNOT_GET_FILESIZE |  | Cannot get temporary attachment file size.
IDS_ATTACHMENT_INVALID_FILESIZE |  | Attachment file size is too big.
IDS_ATTACHMENT_CANNOT_READ_TEMPFILE |  | Cannot read temporary attachment file.
IDS_ATTACHMENT_IS_EMPTY |  | Attachment is empty.
IDS_ATTACHMENT_CANNOT_CREATE_TEMPFILE |  | Cannot create temporary attachment file.
IDS_ATTACHMENT_CANNOT_UNMAP_TEMPFILE |  | Cannot un-map temporary attachment file.
IDS_ATTACHMENT_CANNOT_TRUNCATE_TEMPFILE |  | Cannot truncate temporary attachment file.


SOAP Interfaces

To call the Microsoft CRM APIs, you must go through the corresponding SOAP interface. Each object in the platform has a SOAP interface. These interfaces are located in the following path on the Microsoft CRM server:

http://<server name>/mscrmservices/<objectname>.srf

The following code snippet shows how to set up for a SOAP call:

   // Server should be set with the name of the platform Web server
   string Server = "YourServerName";

   // VirtualDirectory should be set with the name of the Microsoft CRM
   // virtual directory on the platform Web server
   string VirtualDirectory = "mscrmservices";
   string strDir = "http://" + Server + "/" + VirtualDirectory + "/";

// Account proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount oAccount = new Microsoft.Crm.Platform.Proxy.CRMAccount ();
oAccount.Credentials = System.Net.CredentialCache.DefaultCredentials;
oAccount.Url = strDir + "CRMAccount.srf";

The How To section contains detailed examples of using these SOAP interfaces.

For more information about using SOAP interfaces, refer to the Soap reference page on MSDN (msdn.microsoft.com/library/default.asp?url=/nhp/Default.asp?contentid=28000523).


Glossary

This section contains the glossary of terms for the Microsoft® Business Solutions CRM Software Development Kit (SDK).

Note A complete product glossary can be found in the Help documentation in the Microsoft CRM application.

Term | Definition
Access privilege | An access policy against a specific business object.
Access right | A specific right assigned to a user for a business object. Primary examples are read, write, append, delete, share, and assign.
Account | A company that might do business with your organization.
Account address | The address or addresses of a particular account. Accounts can have more than one address. For example, a bill to address and a ship to address.
Activity | In Microsoft CRM, an action to be performed, such as a task, or a communication item that is sent or received, for example, e-mail, phone calls, faxes, letters, and appointments. The status of activities is tracked and the activity history is stored in the system, so users can view the open and closed activities.
Append | An access privilege available in Microsoft CRM that enables users to attach objects to the selected object. The Append and Append To access privileges are actually a pair of privileges that work in combination with each other. Each time a user attaches one object to another, the user is accessing both of these privileges. For example, when you attach a note to a case, you must have the Append privilege on the case and the Append To privilege on the note for the operation to work.
AppendTo | An access privilege available in Microsoft CRM that enables users to attach the selected object to another object. See Append
Application instance | An application instance (or instance) is a customized implementation of a Microsoft CRM application (plus any partner-defined functionality outside the scope of Microsoft CRM) using the core Microsoft CRM services. An instance uses a single store or service deployment unit, typically a database or database cluster.
Article | An organized grouping of information, usually about one subject with subtopics.
Assign | To specify the owner of a business record, such as an account, contact, or case, or an activity, such as an e-mail message, fax, or phone call. In Microsoft CRM, users can assign cases and activities to either a user or a queue.
Basic | A privilege level that specifies the user has access to objects the user owns or shares. Basic is the privilege level with the fewest privileges. The application refers to this level as User.
Business | An entity that provides goods and/or services to others.
Business process | A specified sequence of steps required to complete a task, such as completing a contract. A business process can be performed manually or through the use of a workflow rule.
Business unit | A unit of the top-level organization. Business units can be parents of other business units (child business units).
Child business unit | A business unit that is immediately under another business unit in the business hierarchy of an organization.
Competitor | An entity defined within an organization that might compete for sales opportunities with your business unit. You can create a competitor record that contains information about a competitor, including strengths and weaknesses, and then associate that record with opportunity, product, and sales literature records, so that it is readily available when you need it.
Contact | An individual who is interested in doing business or currently does business with your organization. A contact may or may not be part of a larger organization (account).
Contract | An agreement to provide customer service support during specified coverage dates or for a specified number of cases or length of time. When customers contact customer service, the level of support they receive is determined by their contract.
Customer | The entity with which a business unit conducts a business transaction, in a general sense. In most applications, it will correspond to an aggregate of related "contact" (communication) and "account" (billing) records.
Customer service | The functionality to ensure that customers of a business, both individuals and other businesses, can keep in communication with that business to ensure that they receive appropriate levels of service before, during, and after purchasing the business' products or services.
Customer service representative (CSR) | A role that users can be assigned in Microsoft CRM. A customer service representative provides service to the customers of the organization or business unit through the opening and resolution of cases, among other activities.
Deep | A privilege level that specifies the user has access to objects within his or her business unit and down the business unit hierarchy. The application refers to this level as Parent: Child Business Units.
Deployment | A deployment is a single installation of Microsoft CRM.
Discount list | A compilation of the specific discounts that can be applied to a product, based on volume purchased. Salespeople can add discount lists to price list items in a product.
Fiscal year | A span of time during which the financial activities of an organization are calculated. A fiscal year is divided into fiscal periods, typically defined as semesters, quarters, or months. The organization determines the dates that begin and end its fiscal year, which may not correspond to a traditional calendar year. When a salesperson is assigned a quota in Microsoft CRM, the timeframe for achieving the quota is based on the fiscal year of the organization.
Global | A privilege level that specifies the user has access to objects anywhere within the organization. The application refers to this level as Organization.
Incident (case) | A customer service issue or problem reported by a customer and the activities that customer service representatives use to resolve it.
Invoice | An order that has been billed. It is also a record of a sale to an account, including details about the products or services purchased.
Knowledge Base | A database that internal users can browse or search in to find information about the organization's products and services, often to answer commonly asked questions from customers. This information is in the form of articles and is organized by subjects. The Knowledge Base is searchable by keyword, header text, or full text.
Lead | A potential customer who must be contacted by a salesperson and either qualified or disqualified as a sales opportunity. If a lead is qualified, it can be converted to an opportunity, account, and/or contact in Microsoft CRM.
License | A set of the Microsoft CRM application functionality that an organization purchases. Each license type is associated with a group of privileges.
Local | A privilege level that specifies the user has access to objects within his or her own business unit. The application refers to this level as Business Unit.
Notes | A small item of information that can be appended to any business object. Notes can be appended to one and only one object.
Opportunity | A potential sale to an account or contact that may be won or lost.
Order | A confirmed request for delivery of goods or services based on specified terms. Basically, an order is a quote that has been accepted by a customer.
Organization | In Microsoft CRM, the entity that is internal to the customer relationship management process. The organization is the top level of the Microsoft CRM business hierarchy. The organization can be a specific business, a holding company, a corporation, and so on. There can be only one organization per Microsoft CRM deployment. The organization is divided into business units.
Price list | A compilation of the specific prices that can be charged for each unit in the unit group of a product. Salespeople use price lists to determine the pricing in a quote for a customer. In addition, a default price list can be added to a product.
Private | A setting that hides an object from all users except the owner of the object and any users who have had the object explicitly shared with them.
Process | A definition for an automated workflow consisting of steps, including the actions the workflow should take at each step, and the rules the workflow should use to proceed to the next step.
Process instance | A running instance of a process.
Process template | A process that is not intended to be run, but is used as a starting point to create other processes.
Product | In Microsoft CRM, an item in the product catalog. Salespeople can associate products to their quotes, orders, and invoices, but products can be added to the product catalog only through the Settings area of Microsoft CRM.
Public | The setting that gives anyone with the proper security role access to view and edit an item.
Query | A formal question that can be submitted to the database to retrieve the results.
Queue | A holding container for work items. In Microsoft CRM, queues are used in several places. For example, the Queues area of the Workplace module contains queues of cases and activities. In Knowledge Base Manager, knowledge base articles are sorted into queues in the Draft, Unapproved, and Published folders.
Quota | A revenue objective specified as a specific monetary amount that has been assigned to a salesperson for a specified fiscal period.
Quote | A formal offer for products and/or services, proposed at specific prices and related payment terms, which is sent to a prospective customer.
Reports | A collection and grouping of business data that answers a question or aggregates data in some way.
Role | A defined set of access privileges assigned to a user in Microsoft CRM. The role assigned to a user determines which tasks the user can perform and which parts of the user interface the user can view. In Microsoft CRM, all users must be assigned at least one role in order to access the system.
Sales literature | The documents that business units create with specific information about products and/or services.
Salesperson | A role that users can be assigned in Microsoft CRM. A salesperson is responsible for finding and/or qualifying leads, and working with opportunities, accounts, and contacts in order to generate sales revenue, among other activities.
Search | See Query.
Security principal | Represents a user or team. It is essentially an object that can be assigned a business object for ownership.
Share | To allow another user or team to have a specified amount of access to a particular record, such as a case, account, or contract. For example, you can share an account with a team and specify that they can read the account record, but cannot have write access to it.
Subject | A category used to organize objects in the Knowledge Base and product catalog.
Team | A group of users who share and collaborate on business records in the system. A team can consist of members who report to a single business unit (such as all sales or all customer service) or members who report to different business units (salespeople, customer service representatives, and accounting representatives).
Territory | A geographical area that a salesperson is assigned to.
Unit | A measurement that specifies in what quantity a product will be sold.
User | Either the user of the Microsoft CRM application or the user who is logged in for authentication purposes for each Microsoft CRM API.
Workflow rule | A set of action steps that are enabled for a business process or sales process. Workflow rules determine the required activities for a workflow and in what order those activities must be performed.


Appendix A: Security Roles and Privileges

This topic shows the default security privileges for each predefined security role in Microsoft® Business Solutions CRM licenses.

The following table lists the predefined set of roles that are included in the Microsoft CRM SDK.

Role | Description
CEO-Business Manager | A user who manages the organization at the corporate business level.
Vice President of Sales | A user who manages the business unit at the child business unit level.
Sales Manager | A user who manages sales activities at the business unit or team level.
Salesperson | A salesperson at any level.
Customer Service Representative (CSR) | A customer service representative (CSR) at any level.
CSR Manager | A user who manages customer service activities at the business unit or team level.
Marketing Professional | A user engaged in marketing activities at any level.
System Administrator | A user who defines and implements the process at any level. This role has the full set of privileges.

For more details about these predefined roles, see the Microsoft Business Solutions CRM Implementation Guide.

The following section describes the details of privileges for each object in the system. See Privileges by Object.


Privileges by Object

The following tables list the privileges supported for each object.

Object name | Class name | XML schema name
Account | CRMAccount | account
Activity | CRMActivity | activity
Article | CRMArticle | kbarticle
Article Template | CRMArticleTemplate | kbarticletemplate
Business Unit | BizMerchant | businessunit
Competitor | CRMCompetitor | competitor
Contact | CRMContact | contact
Contract | CRMContract | contract
Contract Template | CRMContractTemplate | contracttemplate
Customization | CRMCustomization |
Email Template | CRMEmailTemplate | template
Incident | CRMIncident | incident
Invoice | CRMInvoice | invoice
Lead | CRMLead | lead
License | CRMLicense | license
News Article | CRMNewsArticle | businessunitnewsarticle
Note | CRMNotesManager | annotation
Opportunity | CRMOpportunity | opportunity
Order | CRMSalesOrder | salesorder
Organization | BizOrganization | organization
Organization UI | CRMCustomization | organizationui
Product | CRMProduct | product
Query | CRMQuery |
Queue | CRMQueue | queue
Quote | CRMQuote | quote
Sales Literature | CRMSalesLiterature | salesliterature
Security Role | SecRole | role
Subject | CRMSubject | subject
Team | BizTeam | team
Territory | CRMTerritory | territory
User | BizUser | systemuser
User Settings | BizUser | usersettings
Workflow Process | CRMProcess | wfprocess
Workflow Process Instance | CRMProcessController | wfprocessinstance


Account Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateAccount | {D26FE964-230B-42DD-AD93-5CC879DE411E} | Basic, Local, Deep, Global | CREATE | Global | Deep | Local | Basic | Basic | Basic | Basic | Global
prvReadAccount | {886B280C-6396-4D56-A0A3-2C1B0A50CEB0} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteAccount | {7863E80F-0AB2-4D67-A641-37D9F342C7E3} | Basic, Local, Deep, Global | WRITE | Global | Global | Global | Global | Global | Global | Global | Global
prvDeleteAccount | {CA6C7690-C935-46B3-BFD2-ABB306C2ACC0} | Basic, Local, Deep, Global | DELETE | Global | Deep | Local | Basic | Basic | Basic | Basic | Global
prvShareAccount | {39B15DFD-09BA-4F30-A390-CAC64B635850} | Basic, Local, Deep, Global | SHARE | Global | Global | Global | Global | Global | Global | Global | Global
prvAssignAccount | {0791AB31-E811-4FDE-974B-E7C5102B09EB} | Basic, Local, Deep, Global | ASSIGN | Global | Deep | Local | Basic | Basic | Basic | Basic | Global
prvAppendAccount | {4E163B38-EA45-49AE-B3DA-4C9DC1C77D8D} | Basic, Local, Deep, Global | APPEND | Global | Global | Global | Global | Global | Global | Global | Global
prvAppendToAccount | {3D6E93A2-B58E-4A4A-B642-374E4A25A6BD} | Basic, Local, Deep, Global | APPENDTO | Global | Global | Global | Global | Global | Global | Global | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Activity Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateActivity | {091DF793-FE5E-44D4-B4CA-7E3F580C4664} | Basic, Local, Deep, Global | CREATE | Global | Deep | Local | Basic | Basic | Local | Basic | Global
prvReadActivity | {650C14FE-3521-45FE-A000-84138688E45D} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteActivity | {0DC8F72C-57D5-4B4D-8892-FE6AAC0E4B81} | Basic, Local, Deep, Global | WRITE | Global | Local | Local | Local | Local | Deep | Basic | Global
prvDeleteActivity | {BB4457F2-9B45-4482-A95A-7ADEF25F388A} | Basic, Local, Deep, Global | DELETE | Global | Deep | Local | Basic | Local | Deep | Basic | Global
prvShareActivity | {B5F2EE06-D359-4495-BBDA-312AAE1C6B1E} | Basic, Local, Deep, Global | SHARE | Global | Global | Global | Global | Global | Global | Global | Global
prvAssignActivity | {8B99344E-EBBF-4F84-8438-E1E34D194DE9} | Basic, Local, Deep, Global | ASSIGN | Global | Deep | Local | Basic | Deep | Deep | Basic | Global
prvAppendActivity | {78777C10-09AB-4326-B4C8-CF5729702937} | Basic, Local, Deep, Global | APPEND | Global | Deep | Local | Local | Local | Deep | Basic | Global
prvAppendToActivity | {6EC8E901-D770-44C0-8F12-D07425F638BD} | Basic, Local, Deep, Global | APPENDTO | Global | Deep | Local | Local | Local | Deep | Basic | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Article Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateArticle | {AF39DB82-2283-4cb2-8381-9D10A0963501} | Global | CREATE | Global | Global | Global |  | Global | Global | Global | Global
prvReadArticle | {437C1F0E-7D06-42fb-94B9-631805033DAA} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteArticle | {4E90F305-3EEC-4c50-AC7C-B2868E6E9D7F} | Global | WRITE | Global | Global | Global | Global | Global | Global | Global | Global
prvDeleteArticle | {78197094-97C9-4dc7-A95B-B46947F3378F} | Global | DELETE | Global | Global |  |  | Global | Global |  | Global
prvPublishArticle | {4EA4A25D-D0B9-427d-BC53-C82A0E983C7F} | Global | WRITE | Global |  |  |  |  | Global |  | Global
prvAppendToArticle | {D6478086-F814-4c83-A347-D9E4D4A15F80} | Global | APPENDTO | Global | Global |  |  | Global | Global |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Article Template Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateArticleTemplate | {AEBCA654-F04F-423f-AF54-13274D317226} | Global | CREATE | Global | Global | Global |  |  | Global | Global | Global
prvReadArticleTemplate | {A794CF4A-169A-44d7-8C90-CBC5D97A1CDF} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteArticleTemplate | {B34521DD-86C5-4586-B296-59F20FE2525C} | Global | WRITE | Global | Global | Global |  |  | Global | Global | Global
prvDeleteArticleTemplate | {0C5A65E5-4B38-49b4-9D58-81EE4575BA5D} | Global | DELETE | Global | Global |  |  |  | Global |  | Global
prvAppendToArticleTemplate | {4EAA39E7-B495-415a-8F7D-C2E8DBD6C346} | Global | APPENDTO | Global | Global |  |  |  | Global |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Business Unit Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateBusinessUnit | {EB20684E-925F-4EBE-A277-699C910EF635} | Deep, Global | CREATE | Global |  |  |  |  |  |  | Global
prvReadBusinessUnit | {487CDBAF-59F9-4DB3-B648-4EED351FF00B} | Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteBusinessUnit | {FCEE0FAA-07DC-42AC-A1F3-E1D63CA29AE7} | Local, Deep, Global | WRITE | Global |  |  |  |  |  |  | Global
prvDisableBusinessUnit | {1C29D21F-C8A6-427B-B470-26E282BC47E7} | Global | WRITE | Global |  |  |  |  |  |  | Global
prvReparentBusinessUnit | {9C8710DB-5260-4DFE-91A3-983B81F1B4D6} | Global | WRITE | Global |  |  |  |  |  |  | Global
prvAppendBusinessUnit | {CF716BA0-04E5-4438-AE87-0B8729CC5219} | Local, Deep, Global | APPENDTO | Global |  |  |  |  |  |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Competitor Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateCompetitor | {8CB63518-5632-4448-9DA5-453C0E096170} | Global | CREATE | Global | Global | Global |  |  |  |  | Global
prvReadCompetitor | {36ABB6E0-E112-4e60-A5DB-D550F9672176} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteCompetitor | {9797DCF9-F100-4598-B67A-72A061702626} | Global | WRITE | Global | Global | Global |  |  |  |  | Global
prvDeleteCompetitor | {7C6F6D68-70FA-480e-8D17-8D6C3140D191} | Global | DELETE | Global | Global | Global |  |  |  |  | Global
prvAppendToCompetitor | {5B0A8DAB-0659-4ce1-8442-3E5D078242FD} | Global | APPENDTO | Global | Global | Global |  |  |  |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Contact Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateContact | {A8BFF87F-0DF0-41D4-BABD-F093FAF1E32C} | Basic, Local, Deep, Global | CREATE | Global | Deep | Local | Basic | Basic | Basic | Basic | Global
prvReadContact | {BA09EC92-12C4-4312-BA16-5715C2CBD6DA} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteContact | {65C22075-4E09-4F39-BAEC-E4BC3A950686} | Basic, Local, Deep, Global | WRITE | Global | Global | Global | Global | Global | Global | Global | Global
prvDeleteContact | {2DDDED47-7488-4039-B9FF-81DEFE81FDD3} | Basic, Local, Deep, Global | DELETE | Global | Deep | Local | Basic | Basic | Basic | Basic | Global
prvShareContact | {AE756940-61FF-4BD3-BFBB-F2B0D542C608} | Basic, Local, Deep, Global | SHARE | Global | Global | Global | Global | Global | Global | Global | Global
prvAssignContact | {43C63782-C7C6-471C-BD9C-24F79BF8C2A1} | Basic, Local, Deep, Global | ASSIGN | Global | Deep | Local | Basic | Basic | Basic | Basic | Global
prvAppendContact | {2B16BA12-6AB4-4AD2-B7C0-8641D2D6DFF2} | Basic, Local, Deep, Global | APPEND | Global | Global | Global | Global | Global | Global | Global | Global
prvAppendToContact | {158327B5-F4C1-448E-93D1-5F135126665B} | Basic, Local, Deep, Global | APPENDTO | Global | Global | Global | Global | Global | Global | Global | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Contract Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateContract | {789B28F6-E8E6-4827-A7E9-30D69D8D4929} | Basic, Local, Deep, Global | CREATE | Global | Deep | Local | Basic | Basic | Local | Basic | Global
prvReadContract | {8022A167-EA97-4c91-A41C-B77C083F7113} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteContract | {7B269B20-F381-41b2-96FB-912786FC398F} | Basic, Local, Deep, Global | WRITE | Global | Global | Global | Global | Global | Global | Global | Global
prvDeleteContract | {FE42DBBC-5804-4034-9B3E-B0A9B6C7F564} | Basic, Local, Deep, Global | DELETE | Global |  |  |  |  |  |  | Global
prvShareContract | {AF754EDD-7D79-42ef-B31F-7008662F301B} | Basic, Local, Deep, Global | SHARE | Global | Global | Global | Global | Global | Global | Global | Global
prvAssignContract | {0DDDB95F-986B-48c2-9ED5-DE5F9A4A0344} | Basic, Local, Deep, Global | ASSIGN | Global | Deep | Local | Basic | Local | Deep | Basic | Global
prvAppendContract | {36A31103-A2DD-4fea-98C9-824124E7CCDE} | Basic, Local, Deep, Global | APPEND | Global | Deep | Local | Local | Local | Deep | Basic | Global
prvAppendToContract | {164E417A-54A6-4180-B772-08F221E751C8} | Basic, Local, Deep, Global | APPENDTO | Global | Deep | Local | Local | Local | Deep | Basic | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Contract Template Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateContractTemplate | {D6CD0451-BCA1-42b0-9FFD-5596A3B9A8F9} | Global | CREATE | Global | Global | Global |  |  |  |  | Global
prvReadContractTemplate | {E438BAE3-55FF-472c-8EA2-6CE5C7348141} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteContractTemplate | {37219212-8A79-4733-8A4D-FDC79489EE93} | Global | WRITE | Global | Global | Global |  |  |  |  | Global
prvDeleteContractTemplate | {3BCD985F-1DA0-4173-9756-31F1C458E962} | Global | DELETE | Global | Global | Global |  |  |  |  | Global
prvAppendToContractTemplate | {38EDDFD6-705C-4cb1-A569-412909EAA576} | Global | APPENDTO | Global | Global | Global |  |  |  |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Customization Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateCustomization | {30713160-C5ED-43c2-9B66-5923CD7236B1} | Basic, Local, Deep, Global | CREATE |  |  |  |  |  |  |  | Global
prvReadCustomization | {7BB3B531-AC45-4977-89C8-B99768E55AB8} | Basic, Local, Deep, Global | READ |  |  |  |  |  |  |  | Global
prvWriteCustomization | {E7A46107-F750-47a0-ADD6-2AE60C3FE413} | Basic, Local, Deep, Global | WRITE |  |  |  |  |  |  |  | Global
prvDeleteCustomization | {10B166F6-2F94-42de-8049-1462D23A0E62} | Basic, Local, Deep, Global | DELETE |  |  |  |  |  |  |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


E-mail Template Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateEmailTemplate | {921DAC3C-3DC0-4f66-83C1-F4E6EA427A45} | Basic, Local, Deep, Global | CREATE | Global | Deep | Local | Basic | Basic | Local | Basic | Global
prvReadEmailTemplate | {6C619DCA-E165-4baa-BA16-EF6F820A0E01} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Local | Global | Global | Global
prvWriteEmailTemplate | {F2CC25B1-BFCC-4f7c-A6C3-9A5FC386391A} | Basic, Local, Deep, Global | WRITE | Global | Global | Global | Basic | Basic | Global | Basic | Global
prvDeleteEmailTemplate | {FFE4299B-7978-4b50-A724-2317DB0D3949} | Basic, Local, Deep, Global | DELETE | Global | Global | Global | Basic | Basic | Global | Basic | Global
prvShareEmailTemplate | {DF6A99AF-703C-47cb-80C6-74EB519AD453} | Basic, Local, Deep, Global | SHARE | Global | Global | Deep | Local |  |  |  | Global
prvAssignEmailTemplate | {17B31E5E-BC94-4967-B83F-C7049EB483DA} | Basic, Local, Deep, Global | ASSIGN | Global | Global | Deep | Local | Local | Local |  | Global
prvAppendEmailTemplate | {57444774-B24C-4684-A514-DFCAB252C331} | Basic, Local, Deep, Global | APPEND | Global | Global | Deep | Local | Local | Local |  | Global
prvAppendToEmailTemplate | {C7057B81-25B8-4940-9CED-EED842B712A5} | Basic, Local, Deep, Global | APPENDTO | Global | Global | Global |  |  | Global |  | Global
prvCreateOrgEmailTemplates | {01750F14-3320-49cc-A7D1-52502CDCD16D} | Global |  | Global | Global | Global |  |  | Global |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Incident (Case) Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateIncident | {6CF9442B-E690-4CAD-8B0A-E60464960B93} | Basic, Local, Deep, Global | CREATE | Global |  |  |  | Basic | Local |  | Global
prvReadIncident | {C2AFF40C-6E68-4437-A631-488A354A1860} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteIncident | {7B26693F-1C0C-4E87-8918-F4CC7D219D70} | Basic, Local, Deep, Global | WRITE | Global |  |  |  | Global | Global |  | Global
prvDeleteIncident | {7E1CDC99-5379-429B-A8D2-AB6FE15F862B} | Basic, Local, Deep, Global | DELETE | Global |  |  |  |  | Deep |  | Global
prvShareIncident | {287E74D0-926A-4922-B732-0CE03C26471B} | Basic, Local, Deep, Global | SHARE | Global | Global | Global | Global | Global | Global | Global | Global
prvAssignIncident | {F8EFFB69-527F-4265-8D63-CC35DEE7B9D2} | Basic, Local, Deep, Global | ASSIGN | Global |  |  |  | Global | Deep |  | Global
prvAppendIncident | {694CFD50-F68A-4D3B-A4A1-5D4A47104359} | Basic, Local, Deep, Global | APPEND | Global |  |  | Local | Global | Global |  | Global
prvAppendToIncident | {0546C535-A7EA-4E79-9047-395BF1D240FF} | Basic, Local, Deep, Global | APPENDTO | Global | Deep | Local | Local | Global | Global |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Invoice Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateInvoice | {0B005177-7E27-4f91-909E-17CFF6476023} | Basic, Local, Deep, Global | CREATE | Global | Deep | Local | Basic | Basic | Basic | Basic | Global
prvReadInvoice | {824B86C8-7851-4abe-9D99-E281E8F1D504} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteInvoice | {31AB0AC9-7A6C-4a9e-B982-5065863F142E} | Basic, Local, Deep, Global | WRITE | Global | Deep | Local | Local | Local | Local | Global | Global
prvDeleteInvoice | {3E14A3C0-F07D-49a8-8691-ECA43F2DD173} | Basic, Local, Deep, Global | DELETE | Global | Deep | Local | Basic | Basic | Basic | Global | Global
prvShareInvoice | {12289BC7-B3FF-4846-8FB6-50CEC63F5B7B} | Basic, Local, Deep, Global | SHARE | Global | Global | Global | Global | Global | Global | Global | Global
prvAssignInvoice | {17A4E6CE-9815-404a-86F5-925C2CE4AE49} | Basic, Local, Deep, Global | ASSIGN | Global | Deep | Local | Basic | Basic | Basic | Global | Global
prvAppendInvoice | {A3360786-E99F-4ee9-965C-A24ED6BD9BE7} | Basic, Local, Deep, Global | APPEND | Global | Deep | Local | Local | Local | Local | Global | Global
prvAppendToInvoice | {6CF5EBF1-A6DA-4522-B51D-86F54AD13FA3} | Basic, Local, Deep, Global | APPENDTO | Global | Deep | Local | Local | Local | Local | Global | Global
prvOverridePriceEngineInvoice | {748F74BF-055C-4fd3-835F-A9ECB7449315} | Basic, Local, Deep, Global | WRITE | Global | Global | Local |  |  |  |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Lead Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateLead | {A41F965B-2619-4C73-8625-DA31945CCCC7} | Basic, Local, Deep, Global | CREATE | Global | Deep | Local | Basic | Basic | Basic | Basic | Global
prvReadLead | {A8ECAC53-09E8-4A13-B598-8D8C87BC3D33} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteLead | {CB4B339F-2B45-447E-BDD3-0BF4BBEBC294} | Basic, Local, Deep, Global | WRITE | Global | Global | Global | Global | Basic | Basic | Global | Global
prvDeleteLead | {B42D2F65-8929-455D-ABE7-B4EC8367A8E1} | Basic, Local, Deep, Global | DELETE | Global | Deep | Local | Basic | Basic | Basic |  | Global
prvShareLead | {9805EBD7-4A57-4558-A7EF-C0BA93D28C68} | Basic, Local, Deep, Global | SHARE | Global | Global | Global | Global | Global | Global |  | Global
prvAssignLead | {7755E1BC-6F11-465E-8ED0-A1616C5D32C4} | Basic, Local, Deep, Global | ASSIGN | Global | Deep | Local | Basic | Basic | Basic | Local | Global
prvAppendLead | {387D6489-CFCC-47D7-98AF-5B7946D7691D} | Basic, Local, Deep, Global | APPEND | Global | Global | Global | Global | Basic | Basic |  | Global
prvAppendToLead | {5E8D193D-184D-44BE-92D8-0F3845D7A9EB} | Basic, Local, Deep, Global | APPENDTO | Global | Global | Global | Global | Basic | Basic |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


License Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateLicense | {53BDAFCE-F1FD-4be5-B98A-7DABDF60A040} | Global | CREATE | Global | Global | Global |  |  | Global |  | Global
prvReadLicense | {B93E1FC6-E58C-4f0f-B0C8-59161EDF0455} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvGrantLicense | {39ACD563-F576-42ce-94AE-B2BA49EA7E2C} | Global | WRITE | Global | Global |  |  |  |  |  | Global
prvDeleteLicense | {9A14AC6A-E5FB-47fa-99E9-EDA0F2F2459E} | Global | DELETE | Global | Global |  |  |  |  |  | Global
prvRevokeLicense | {54A0FCF0-85E6-4686-8F64-A389203DBA41} | Global | WRITE | Global | Global |  |  |  |  |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


News Article Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateNewsArticle | {3B9A9A49-F645-4c95-BAD9-BD179057C278} | Global | CREATE | Global | Global | Global |  |  | Global | Global | Global
prvReadNewsArticle | {6CBB06B6-2651-4fe5-AFAD-36E1967E70EF} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteNewsArticle | {738A3EC5-3159-426a-8DAA-A7F185F7E0BE} | Global | WRITE | Global | Global | Global |  |  | Global | Global | Global
prvDeleteNewsArticle | {501BE170-72CB-4fb0-9D82-381F3CF03079} | Global | DELETE | Global | Global | Global |  |  | Global | Global | Global
prvAppendToNewsArticle | {BEFB58AE-8619-4774-B093-6A0C1458A584} | Global | APPENDTO | Global | Global | Global |  |  | Global | Global | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Note Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateNote | {DD78A732-386C-442a-BE37-C9353C34C997} | Basic, Local, Deep, Global | CREATE | Global | Deep | Local | Basic | Basic | Basic | Basic | Global
prvReadNote | {3260AD79-203D-41fd-BF2C-F853A5D93483} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteNote | {ED854F7D-286D-4c8b-A716-C70A0106D5A5} | Basic, Local, Deep, Global | WRITE | Global | Basic | Basic | Basic | Basic | Basic | Basic | Global
prvDeleteNote | {395587E4-E212-43ef-A85E-0F0FD53B35E3} | Basic, Local, Deep, Global | DELETE | Global | Deep | Local | Basic | Basic | Deep | Basic | Global
prvShareNote | {5906D1C0-A3E9-4cb4-BC7D-6A122DA12092} | Basic, Local, Deep, Global | SHARE | Global | Global | Global | Global | Global | Global | Global | Global
prvAssignNote | {2F29007F-7948-446b-A294-10D9F722CAB3} | Basic, Local, Deep, Global | ASSIGN | Global | Deep | Local | Basic | Basic | Deep | Basic | Global
prvAppendNote | {5C270B76-3087-4f97-BBCE-678ECC588FBA} | Basic, Local, Deep, Global | APPEND | Global | Deep | Local | Local | Local | Deep | Basic | Global
prvAppendToNote | {ECA34A9E-F50D-487e-AB69-BD06BA6EE1A1} | Basic, Local, Deep, Global | APPENDTO | Global | Deep | Local | Local | Local | Deep | Basic | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Opportunity Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateOpportunity | {6B882C27-9ED7-467F-BE0F-213A605E0A13} | Basic, Local, Deep, Global | CREATE | Global | Deep | Local | Basic | Basic | Basic | Basic | Global
prvReadOpportunity | {F7767F74-628D-48B3-A79F-9C6E24FEDB69} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteOpportunity | {EEEB5856-3F80-4886-8AE2-456AD9141244} | Basic, Local, Deep, Global | WRITE | Global | Global | Global | Global | Basic | Basic | Global | Global
prvDeleteOpportunity | {EC005BA2-AD88-4B96-962C-23BBEB41D2E1} | Basic, Local, Deep, Global | DELETE | Global | Deep | Local | Basic | Basic | Basic |  | Global
prvShareOpportunity | {240EDD9B-83E1-46B4-AA25-576AD3C75186} | Basic, Local, Deep, Global | SHARE | Global | Global | Global | Global | Global | Global |  | Global
prvAssignOpportunity | {8A4862A1-C88A-4BE9-9A60-1E6D9258FA52} | Basic, Local, Deep, Global | ASSIGN | Global | Deep | Local | Basic | Basic | Basic | Local | Global
prvAppendOpportunity | {A2420282-24DE-424B-8997-8D316091E310} | Basic, Local, Deep, Global | APPEND | Global | Global | Global | Global | Basic | Basic |  | Global
prvAppendToOpportunity | {DAE65DA8-E481-410D-BFCC-16C37F894604} | Basic, Local, Deep, Global | APPENDTO | Global | Global | Global | Global | Basic | Basic |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Order Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateOrder | {83F518E2-F311-4bb4-894F-A7EE55E558A7} | Basic, Local, Deep, Global | CREATE | Global | Deep | Local | Basic | Basic | Basic | Basic | Global
prvReadOrder | {6F81B089-36D1-476e-8519-33DF34AEFE11} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteOrder | {13121F22-3211-44d5-AB17-ADCF699CF0EB} | Basic, Local, Deep, Global | WRITE | Global | Deep | Local | Local | Local | Local | Global | Global
prvDeleteOrder | {CEB5CFAE-F745-4a60-8023-B5B203C72E34} | Basic, Local, Deep, Global | DELETE | Global | Deep | Local | Basic | Basic | Basic | Global | Global
prvShareOrder | {7BB2363E-AEAE-44c9-ADC9-D1F13FC355C1} | Basic, Local, Deep, Global | SHARE | Global | Global | Global | Global | Global | Global | Global | Global
prvAssignOrder | {F9388C46-82AC-455c-8FCF-628351169404} | Basic, Local, Deep, Global | ASSIGN | Global | Deep | Local | Basic | Basic | Basic | Global | Global
prvAppendOrder | {1DCF75FE-3540-4f93-84BB-D1E8EEC6C8D9} | Basic, Local, Deep, Global | APPEND | Global | Deep | Local | Local | Local | Local | Global | Global
prvAppendToOrder | {45B189D7-ADB7-474b-857B-98783812F7F6} | Basic, Local, Deep, Global | APPENDTO | Global | Deep | Local | Local | Local | Local | Global | Global
prvOverridePriceEngineOrder | {0186F903-2B6A-4230-9838-0B64080A7568} | Basic, Local, Deep, Global | WRITE | Global | Global | Local |  |  |  |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Organization Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateOrganization | {9E931DB8-975F-4dbd-BEFD-9244895D49B8} | Global | CREATE |  |  |  |  |  |  |  | Global
prvReadOrganization | {DBD3AD17-B6BD-46c8-8DB7-179FEC82C937} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteOrganization | {9F7B7E89-E5F6-41fd-8390-F06A7EC66D25} | Global | WRITE |  |  |  |  |  |  |  | Global
prvDeleteOrganization | {9A48030C-0AA6-434e-8DE5-C8EAB10D7E8A} | Global | DELETE |  |  |  |  |  |  |  | Global
prvAppendToOrganization | {E7753B34-17F3-400e-8396-88E24B8DC519} | Global | APPENDTO |  |  |  |  |  |  |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Organization UI Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateOrganizationUI | {39C79715-9CFD-41ff-A4FF-E25740FBF519} | Basic, Local, Deep, Global | CREATE |  |  |  |  |  |  |  | Global
prvReadOrganizationUI | {D7BF8604-022A-498e-A612-2E54FD151E89} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteOrganizationUI | {424D2569-BAA9-44c6-8789-E0A38757D20B} | Basic, Local, Deep, Global | WRITE |  |  |  |  |  |  |  | Global
prvDeleteOrganizationUI | {FD169D0D-38CB-4ce9-9A64-B74C94ABD81F} | Basic, Local, Deep, Global | DELETE |  |  |  |  |  |  |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Product Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateProduct | {5F873211-084E-4eb2-94B8-98F068440DC2} | Global | CREATE | Global | Global | Global |  |  | Global | Global | Global
prvReadProduct | {60D420CA-7A88-4c0d-8286-C425B527FA98} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteProduct | {4F86580F-D0AD-473a-91E2-E3FC7B7D5D0C} | Global | WRITE | Global | Global | Global |  |  | Global | Global | Global
prvDeleteProduct | {CC04CB55-CC00-4315-A100-0DAFD1F1CABA} | Global | DELETE | Global | Global | Global |  |  | Global | Global | Global
prvAppendProduct | {D589F1A0-E1E1-4585-86C4-6B6DC33E8F65} | Global | APPEND | Global | Global | Global | Global | Global | Global | Global | Global
prvAppendToProduct | {CC345E3D-927F-4aa2-9BE5-6A79E2DB3577} | Global | APPENDTO | Global | Global | Global | Global | Global | Global | Global | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Query Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateQuery | {371F85F8-0D1B-4177-A790-550D371E91EC} | Global | CREATE | Global | Global | Global | Global | Global | Global | Global | Global
prvReadQuery | {902D70D3-2FF8-4d93-92F9-8EFDCF889AF8} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteQuery | {ECE4C21D-060A-4e86-982B-F97410CA5F71} | Global | WRITE | Global | Global | Global | Global | Global | Global | Global | Global
prvDeleteQuery | {7389889C-4149-4f74-86F6-12C2A9CC577B} | Global | DELETE | Global | Global | Global |  |  | Global |  | Global
prvAppendToQuery | {594C56E2-EC82-44a1-BFC5-5FC8B585935C} | Global | APPENDTO | Global | Global | Global | Global | Global | Global | Global | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Queue Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateQueue | {FA14449F-B8D3-4ded-AE4E-3D2738D2A634} | Global | CREATE | Global | Global |  |  |  | Global |  | Global
prvReadQueue | {B140E729-DFEB-4ba1-A33F-39FF830BAC90} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteQueue | {28C10364-C205-48fa-A956-FBCEC1A23053} | Global | WRITE | Global | Global |  |  |  | Global |  | Global
prvAppendToQueue | {041FDB4C-BBB8-4792-90DB-51C19D067CA2} | Global | APPENDTO | Global | Global |  |  |  | Global |  | Global
prvDeleteQueue | {150B7E82-179F-4f88-AF25-D305EEA01D8E} | Global | DELETE | Global | Global |  |  |  | Global |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Quote Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateQuote | {477DFD23-A640-4ebd-981A-183737963D7F} | Basic, Local, Deep, Global | CREATE | Global | Deep | Local | Basic | Basic | Basic | Basic | Global
prvReadQuote | {00A8D04E-EDE7-4884-AE18-09C6E55344CA} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteQuote | {356F5577-C5C3-44c4-93D9-442B282FA8DF} | Basic, Local, Deep, Global | WRITE | Global | Deep | Local | Local | Local | Local | Global | Global
prvDeleteQuote | {DCC1D522-DFD6-46fc-BC6C-B90A097BA309} | Basic, Local, Deep, Global | DELETE | Global | Deep | Local | Basic | Basic | Basic | Global | Global
prvShareQuote | {FA072959-EC94-4631-B419-91EBD45562D3} | Basic, Local, Deep, Global | SHARE | Global | Global | Global | Global | Global | Global | Global | Global
prvAssignQuote | {01F1FC93-B5B0-4c43-8196-96AB0D0113E6} | Basic, Local, Deep, Global | ASSIGN | Global | Deep | Local | Basic | Basic | Basic | Global | Global
prvAppendQuote | {3027B0B3-192E-432d-851B-ACC5DC8EB953} | Basic, Local, Deep, Global | APPEND | Global | Deep | Local | Local | Local | Local | Global | Global
prvAppendToQuote | {41035DF9-7AD8-4af1-8E78-F44672FF1ADB} | Basic, Local, Deep, Global | APPENDTO | Global | Deep | Local | Local | Local | Local | Global | Global
prvOverridePriceEngineQuote | {45C781DA-DB3E-439b-9EFE-D1B5484B832F} | Basic, Local, Deep, Global | WRITE | Global | Global | Local |  |  |  |  | Global

Key:

Symbol | Abbreviation | Access level
Global | Global | Global
Deep | Deep | Deep
Local | Local | Local
Basic | Basic | Basic
None | None | None


Sales Literature Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateSalesLiterature | {5D076EA0-354B-41cf-8BA8-EA38C93F4DC2} | Global | CREATE | Global | Global | Global |  |  |  |  | Global
prvReadSalesLiterature | {9DD55B66-8ADE-4326-BF0F-0BDE6A9E4964} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteSalesLiterature | {8F4E3B25-FC7E-4ea9-866D-B24071EE4ECE} | Global | WRITE | Global | Global | Global |  |  |  |  | Global
prvDeleteSalesLiterature | {7FFAF8D7-8266-4816-B6F8-1D436E7DD95A} | Global | DELETE | Global | Global | Global |  |  |  |  | Global
prvAppendSalesLiterature | {CAB32FE6-2A53-4a29-BF47-9D2B7CA4356C} | Global | APPEND | Global | Global | Global | Global | Global | Global |  | Global
prvAppendToSalesLiterature | {0039D6AA-0500-44c9-A99C-8A7BC1BDB36B} | Global | APPENDTO | Global | Global | Global | Global | Global | Global |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Security Role Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateRole | {7398C78C-29A5-4982-9ADA-73390F64FE99} | Local, Deep, Global | CREATE | Global | Deep |  |  |  |  |  | Global
prvReadRole | {222A920A-2778-4564-85CB-E78DDE8E4276} | Local, Deep, Global | READ | Global | Global | Global | Local | Local | Global | Local | Global
prvWriteRole | {BD123E14-17BA-40f6-8D8B-18F4BFFA7E50} | Local, Deep, Global | WRITE | Global | Deep |  |  |  |  |  | Global
prvDeleteRole | {34ABE1B8-E9BC-4be0-9EF3-09459CA7AE57} | Local, Deep, Global | DELETE | Global |  |  |  |  |  |  | Global
prvAssignRole | {836D6C7B-CF1D-47f0-8021-8E41091C489C} | Local, Deep, Global | ASSIGN | Global | Deep |  |  |  |  |  | Global
prvAppendToRole | {EAA02B5B-DC56-4aa3-A889-718F25AA0075} | Local, Deep, Global | APPENDTO | Global |  |  |  |  |  |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Subject Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateSubject | {8668262A-942F-4089-AF7E-6EA2DEB6A80B} | Global | CREATE | Global | Global |  |  |  | Global |  | Global
prvReadSubject | {D5D40A46-B459-438b-941E-D55691BF0827} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteSubject | {DAE584F9-D69B-4b8b-AA38-E15E908D4FD2} | Global | WRITE | Global | Global |  |  |  | Global |  | Global
prvDeleteSubject | {94D54374-1CA7-47a3-A0C8-73EC80434EE0} | Global | DELETE | Global | Global |  |  |  | Global |  | Global
prvAppendToSubject | {63A357A1-D923-467d-828E-9204E3E30F95} | Global | APPENDTO | Global | Global |  |  |  | Global |  | Global

Key:

Symbol | Abbreviation | Access level
Global | Global | Global
Deep | Deep | Deep
Local | Local | Local
Basic | Basic | Basic
None | None | None


Territory Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateTerritory | {00DAF56C-9520-4777-98FF-DB27E5DAE5C4} | Global | CREATE | Global | Global | Global |  |  |  | Global | Global
prvReadTerritory | {D2409739-F135-422e-966D-129351AA0CE7} | Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteTerritory | {D0C30FFD-AF29-427e-87AB-546C813E1D20} | Global | WRITE | Global | Global | Global |  |  |  | Global | Global
prvDeleteTerritory | {5051AE4A-F1EA-412e-ACE1-F72FA7247C87} | Global | DELETE | Global | Global | Global |  |  |  | Global | Global
prvAppendToTerritory | {B9BB73F7-C659-4c9d-944A-F2AF1784D56A} | Global | APPENDTO | Global | Global | Global |  |  |  | Global | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Team Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateTeam | {4807B998-6B4F-4D57-9CF6-515F50E43D79} | Local | CREATE | Global | Deep | Local |  |  | Local |  | Global
prvReadTeam | {663D1920-56E1-4166-89F0-47F3330923A8} | Local | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteTeam | {5ADFB065-B9A6-4481-91D1-9D91F78BB30A} | Local | WRITE | Global | Global | Global |  |  | Global |  | Global
prvReparentTeam | {E6672D30-ED9E-4A1D-847D-7B1D05CD12E2} | Local | WRITE | Global | Global | Global |  |  | Global |  | Global
prvAppendToTeam | {3CE923F7-8F8E-4288-A4BF-B96FD6A67436} | Local | APPENDTO | Global | Global | Global |  |  | Global |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


User Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateUser | {0A3D4421-AF6D-42ED-B3C2-B51DEB73D1D5} | Local | CREATE | Global | Deep | Local |  |  | Local |  | Global
prvReadUser | {76FAAD15-BC44-4F4D-84DC-DD1E1DDA74D9} | Local | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteUser | {DBB088D1-C7B7-40E7-8728-FDEDB539319C} | Local | WRITE | Global | Deep | Deep |  |  | Deep | Deep | Global
prvDisableUser | {095860D1-42DE-4EFC-8D53-4B60E74D3D26} | Local | WRITE | Global | Deep | Deep |  |  | Deep | Deep | Global
prvReparentUser | {2759A407-C37F-4955-AA64-05F44BB88402} | Local | WRITE | Global | Deep | Deep |  |  | Deep | Deep | Global
prvAssignManager | {28C3A786-82A5-4ff6-8D54-4876DB4BA2F8} | Local | WRITE | Global | Deep | Deep |  |  | Deep | Deep | Global
prvAssignTerritory | {D5B32FC2-2F74-486b-A2D5-7A2506D1E580} | Local | WRITE | Global | Deep | Deep |  |  | Deep | Deep | Global
prvAppendToUser | {3399E6D2-DD3C-4a14-8433-39C1ECA27AAA} | Local | APPENDTO | Global | Deep | Deep |  |  | Deep | Deep | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


User Settings Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateUserSettings | {E3AF716C-2B32-4e53-9554-24C36AA0A3AD} | Basic, Local, Deep, Global | CREATE | Global | Deep | Local | Local | Local | Local | Local | Global
prvReadUserSettings | {8437FA7C-3681-4fc7-BFD8-53A23FDECD65} | Basic, Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteUserSettings | {588725DD-C878-41c5-A4C3-5EFC93CD3FFD} | Basic, Local, Deep, Global | WRITE | Global | Deep | Local | Basic | Basic | Local | Basic | Global
prvAppendToUserSettings | {600DA2B2-8FCB-437f-8632-2DAC9B5F64E8} | Basic, Local, Deep, Global | APPENDTO | Global | Deep | Local | Basic | Basic | Local | Basic | Global
prvDeleteUserSettings | {00BCB198-F3D8-4451-98A1-36642A084B8F} | Basic, Local, Deep, Global | DELETE | Global | Deep | Local | Basic | Basic | Local | Basic | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Workflow Process Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateWorkflowProcess | {47FF39C1-463C-4b78-BA41-5FBF7BF21484} | Local, Deep, Global | CREATE | Global | Deep | Local | Local | Local | Local | Local | Global
prvReadWorkflowProcess | {9875986D-5A5D-4833-A04C-1FC8C6DE9A93} | Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteWorkflowProcess | {669622DB-83EF-4531-9F6A-4F8E0DAA788D} | Local, Deep, Global | WRITE | Global | Global | Local | Local | Local | Local | Local | Global
prvDeleteWorkflowProcess | {DCD13AF7-253F-43fe-B645-E64C3EEE609D} | Local, Deep, Global | DELETE | Global | Global |  |  |  |  |  | Global
prvAppendToWorkflowProcess | {8CA84853-E70A-4dec-921E-FAE5182CEAC1} | Local, Deep, Global | APPENDTO | Global | Global |  |  |  |  |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Workflow Process Instance Privileges

The following table lists the privileges for this object. The role names are abbreviated. See Appendix A for the complete names.

Privilege name | Privilege GUID | Allowed Scope | Access right | CEO-Bus Mgr | VP Sales | Sales Mgr | Sales- person | CSR | CSR Mgr | Mktg Prof | Sys Admin
prvCreateWorkflowProcessInstance | {2B0FC1B1-409A-4e9a-8EDB-0E5A57482078} | Local, Deep, Global | CREATE | Global | Deep | Local | Local | Local | Local | Local | Global
prvReadWorkflowProcessInstance | {466EFFEB-3AC9-46e9-8429-8A58112DA74B} | Local, Deep, Global | READ | Global | Global | Global | Global | Global | Global | Global | Global
prvWriteWorkflowProcessInstance | {BB299E0D-F2F9-4664-95E1-9605BFCF544B} | Local, Deep, Global | WRITE | Global | Global | Local | Local | Local | Local | Local | Global
prvDeleteWorkflowProcessInstance | {FDD603E3-B127-4ab2-8972-992BF6D959B8} | Local, Deep, Global | DELETE | Global | Global |  |  |  |  |  | Global
prvAppendToWorkflowProcessInstance | {AD9F23BD-CC12-4cb5-8D31-7ED8CFF171B0} | Local, Deep, Global | APPENDTO | Global | Global |  |  |  |  |  | Global

Key:

Symbol | Description of access level
Global | Global
Deep | Deep
Local | Local
Basic | Basic
None | None


Copyright

Information in this document, including URL and other Internet Web site references, is subject to change without notice. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, e-mail address, logo, person, place or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.

© 2003 Microsoft Corporation. All rights reserved.

Microsoft, MS-DOS, Windows, Windows NT, Windows Server, Active Directory, Outlook, Visual Basic, and Visual Studio are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.

The names of actual companies and products mentioned herein may be the trademarks of their respective owners.


The following list of entities is generated from the MS-CRM metabase. It was generated at 8/21/2003 10:37:43 AM. This is not a complete list of entities from the CRM database, instead, it's the list of entities which allow CRUD operations, and have corresponding CRM object model representations.

Name | Entity Id
account | 7302cc49-981d-4993-b728-615e80e9e4ef
activity | 45456bc4-1f15-4016-9128-c21a9f985a25
activitymimeattachment | 376faa10-af9e-4a2e-902a-898d87e704bf
activityparty | cecb5440-f854-4b10-b0a1-8a9a0576d731
annotation | 5e6d2c2c-ce47-49f9-98f8-7ca15dcf5de5
annualfiscalcalendar (Constructed Entity) | 431597d6-31c3-42f3-b19c-0cd7450c669c
appointmentactivity (Constructed Entity) | 22bcf9a0-e0e4-4213-8b28-b393fc42fe97
businessunit | e47262d8-058a-4b5d-a62a-7e5bbeae2b60
businessunitnewsarticle | 22e6120a-4812-4dd2-94ff-671770110f05
chatactivity (Constructed Entity) | 1c9af7bc-cba6-49df-9ecb-7883f5c12ca9
competitor | 93a57c4a-b901-438e-ac88-fc22555a31e6
competitoraddress | ad2dc3bb-8a42-4d99-94c6-f3088cf33625
competitorcontact | 4fb8737c-971b-4cfb-9ddc-95ccc0a217d8
competitorcontactaddress | 3f7a61c6-ed25-4b08-bcec-068428d5e962
competitorrevenuereport | 634fbfc9-ef16-4957-b293-27afa60c2786
contact | 9d6f197c-192f-4a5d-aed7-7cbdb804487e
contract | 5d3ca1c6-50d5-457d-b4df-7dc284ef57fb
contractdetail | 679bb9f3-eed9-4249-8dc9-c6ca5c9a3abc
contracttemplate | 0473bd33-dadd-4660-9367-0a28d3560e93
customeraddress | dc3c1401-e63f-405f-a186-b577d1c6956b
discount | 59f41ccc-02d7-49ac-85e9-4393a6af21c1
discounttype | 59409669-e6a4-44f8-ba2a-5e30c5032026
documentindex | e664a82b-8c8e-44d3-84f2-e4ce1a4c5e1b
emailactivity (Constructed Entity) | 0b1367c3-615e-479f-b4f4-839588da6d61
faxactivity (Constructed Entity) | e1488f01-5362-4bac-be0a-1c8211cd4740
fixedmonthlyfiscalcalendar (Constructed Entity) | fdc9d07d-9a04-437e-b66e-c066c033ba1d
incident | e44584b3-4de1-497a-8afd-8049d1f24a59
incidententryactivity (Constructed Entity) | 40277d28-cde7-40d4-8df6-1d968d55132f
incidentresolutionactivity (Constructed Entity) | 1e835223-eb0b-48a5-b23f-2f5899f4be76
integrationstatus | 02a951cd-42eb-4122-874b-2117499d92c1
internaladdress | 6e00bbdd-44d6-4a14-8746-37cee0ee7617
invoice | 96af2179-7af4-41c7-910d-e066685b80a0
invoicedetail | 845745fb-42b4-4d4e-b73f-719fbd0b6560
kbarticle | d14927d5-acb1-4df0-b1e7-3b8b85c40bff
kbarticlecomment | 9eac46ea-e3dd-4cd3-94e1-a41364c3aecb
kbarticletemplate | 65deb7c9-504e-4d57-ada0-10ef491dac2f
lead | 8dc65951-b55b-46ae-bf21-160cabcfdaa8
leadaddress | 9cf954fd-cd1e-49ff-a37f-83b06588af26
letteractivity (Constructed Entity) | 2774cf65-eef5-494b-a7fd-b9405a7f6bb2
license | 1ce53166-52cc-4d3e-9048-8b450e821e24
mailinglist | ac931939-aa21-4508-a2fb-9e98f964493d
monthlyfiscalcalendar (Constructed Entity) | 7bc1862a-80c6-4329-a699-94209d3e832d
objectauditlog | 431c31ac-1901-48a4-9fe2-7ab77a0138e3
opportunity | 41d73eea-8a7e-416c-a3ff-3f4d5813852d
opportunitycloseactivity (Constructed Entity) | a5d6a29b-446d-47d0-8b94-882bfce78120
opportunityproduct | bd255593-6850-485f-8377-8c3e207d8ae2
ordercloseactivity (Constructed Entity) | 9b8aa2cd-de93-4009-9308-2a34037608dd
organization | 982f80aa-81f9-4b3b-80e9-2f21564e3b0d
organizationui | c2aa53ba-05a8-4484-8d18-2d73a78d07ba
phonecallactivity (Constructed Entity) | 5ca56fee-5e33-4a44-805c-efce8c287d77
pricelevel | a4f5c88a-643c-41c4-8804-61cd901d82b8
principalownedobjects | 16e6aa65-0c54-4ace-a81f-52278bc6b6f0
privilege | e407e5c1-4812-41d7-b2a3-3acf399ac251
product | 55db1d51-376a-4ff6-bee5-e84098cc8e43
productpricelevel | 563c4250-4595-4a6a-b35e-c59ac9dc7454
quarterlyfiscalcalendar (Constructed Entity) | 09d5f709-e9c2-4553-b3ff-4f127bf49774
queue | 01ba2baa-a3dc-49e8-92d8-a50dd6d90db2
queueitem | a5e62b79-8a86-435f-a13d-a818d4f3c239
quote | 968437a3-5fa5-4fa5-a5fa-262ba6d159d2
quotecloseactivity (Constructed Entity) | 71bc9c86-2c24-4348-9112-a18ffbb9c4ba
quotedetail | 073a23e2-3711-431e-81af-7b03a0661d24
role | 27042fad-947d-4ff3-b5fa-f59c87eabee1
roletemplate | c49b5064-24c5-46e1-86aa-2b4759e10eac
salesliterature | 2a3e6bf2-65bb-4c4e-9552-2ee1ab7f0af2
salesliteratureitem | f8c577c7-5935-42ce-bc3f-5e2efe4643ab
salesorder | 622c6d58-f05f-444b-908e-7dc3c3ca14ec
salesorderdetail | 497a005b-7059-40e4-b448-6ebab4b6fc07
savedquery | e669964b-2074-4627-bbcc-c22abdf0ec48
savedqueryheaders | 3852f98f-a33f-4a5c-ae37-a93f777c6fa6
semiannualfiscalcalendar (Constructed Entity) | 985b1f3b-eb56-479d-b743-b5b96caf8692
subject | 4152a2b2-17cf-481f-bd4c-5a9af2070781
subscription | a02119ac-2cc1-4df7-92cd-7bef91dacafb
syncentry | 76141fcf-c05a-4ae4-b096-176665c3d5a8
systemuser | 115718b9-1b3c-44f4-8bb4-77ff770b6a5a
team | 3e6a0618-03d5-4981-8c20-6419739e2e6b
template | 66cb6a6d-eef9-41df-bec5-ad7a26c03509
territory | 1d30db46-1d21-4768-9c6e-45f02d2f2aa6
trackeditemhistory | 0bf865fc-1980-4ad4-97f9-feeb33ab8b3c
unresolvedaddress | 747e0148-03cd-499b-b2e5-c4dd0178bb7b
uom | dc77f0b7-f46f-41e6-9b84-c9c927aeca09
uomschedule | ba278f04-b290-4637-a4d9-1c5bcdb6695e
userfiscalcalendar | b333883d-aefc-4e8e-84a8-158a60f053de
usersettings | 14d0c228-8bc8-4a42-85af-9764e75a9f55
wfaction | 82d66929-fd04-4bbc-acc4-acd44d289692
wfactionlog | 5913f7c5-d42c-4290-8246-d4c9c465978d
wfcondition | e1e06091-392c-4688-a098-8e05ded332b1
wfeventlog | 9e2e6149-bd34-4523-bade-f1a92d82fa8c
wfparameter | 63a4d05f-469a-4fbe-a4b2-343db02950d0
wfprocess | 67add829-99e7-40fd-a49d-43a6c475f189
wfprocessinstance | a8b7af74-a169-4435-b9c6-88a7d0cfaf72
wfrule | 32c9f7fa-762b-4770-bb5b-46ad4fe6a499
wfrulelog | 53a8d096-dc00-45fb-ab9f-38af627ffc8a
wfstep | b9890be1-f11b-4867-b90b-0494637759c2


This file must exist for now in order for createschemas.js to run properly.