CreateRequest 類別

Contains the data that is needed to create a record.

命名空間: Microsoft.Xrm.Sdk.Messages
組件: Microsoft.Xrm.Sdk (在 Microsoft.Xrm.Sdk.dll 中)

語法

'宣告
<DataContractAttribute(Namespace:="https://schemas.microsoft.com/xrm/2011/Contracts")> _
Public NotInheritable Class CreateRequest
    Inherits OrganizationRequest
[DataContractAttribute(Namespace="https://schemas.microsoft.com/xrm/2011/Contracts")] 
public sealed class CreateRequest : OrganizationRequest

範例

The following example shows how to use this message. For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface. For the complete sample, see the link later in this topic.

//Set the Web Resource properties
WebResource wr = new WebResource
{
    Content = getEncodedFileContents(@"../../" + webResource.path),
    DisplayName = webResource.displayName,
    Description = webResource.description,
    Name = _customizationPrefix + webResource.name,
    LogicalName = WebResource.EntityLogicalName,
    WebResourceType = new OptionSetValue(Int32.Parse(webResource.type))
};

// Using CreateRequest because we want to add an optional parameter
CreateRequest cr = new CreateRequest
{
    Target = wr
};
//Set the SolutionUniqueName optional parameter so the Web Resources will be
// created in the context of a specific solution.
cr.Parameters.Add("SolutionUniqueName", _ImportWebResourcesSolutionUniqueName);

CreateResponse cresp = (CreateResponse)_serviceProxy.Execute(cr);

備註

Message Availability

Not all entity types support this message offline. For some supported entities, this message works regardless whether the caller is connected to the server or offline. For other entities, the caller must be connected to the server before the message works. For more information, see Supported Entities later in this topic.

Usage

將此類別的執行個體傳遞至 Execute method, which returns an instance of the CreateResponse class.

此訊息支援一個或多個選用參數。如需詳細資訊,請參閱在訊息中傳遞選用參數

Privileges and Access Rights

To perform this action, the caller must have privileges on the specified entity in the entity parameter. For a list of the required privileges, see Create Privileges.

Notes for Callers

This message creates a record with related records in one transaction. For a less complex method that creates a single record, use the Create method.

By default, the caller becomes the owner for the new record. For this message to work, the caller must have both Create and Read privileges for the entity. For more information, see Privileges by Entity. Or you can set the ownerid attribute for the record to the ID of another user.

Supported Entities

You can use this method to create any record of an entity (includes custom entities) that supports the CreateRequest message.

下表顯示支援此訊息的預設實體。對於此訊息的列示實體,如果呼叫端必須連線至伺服器,Availability 資料行會顯示 Server,如果呼叫端可以連線至伺服器或中斷伺服器連線,則會顯示 Both。

Entity Availability

Account

2 (Both)

ActivityMimeAttachment

2 (Both)

Annotation

2 (Both)

AnnualFiscalCalendar

2 (Both)

Appointment

2 (Both)

AsyncOperation

2 (Both)

AttributeMap

2 (Both)

BusinessUnit

2 (Both)

BusinessUnitNewsArticle

2 (Both)

Calendar

2 (Both)

Campaign

2 (Both)

CampaignActivity

2 (Both)

CampaignResponse

2 (Both)

ColumnMapping

2 (Both)

Competitor

2 (Both)

Connection

2 (Both)

ConnectionRole

2 (Both)

ConnectionRoleObjectTypeCode

2 (Both)

ConstraintBasedGroup

2 (Both)

Contact

2 (Both)

Contract

2 (Both)

ContractDetail

2 (Both)

ContractTemplate

2 (Both)

ConvertRule

2 (Both)

ConvertRuleItem

2 (Both)

CustomerAddress

2 (Both)

CustomerOpportunityRole

2 (Both)

CustomerRelationship

2 (Both)

Discount

2 (Both)

DiscountType

2 (Both)

DuplicateRule

2 (Both)

DuplicateRuleCondition

2 (Both)

DynamicProperty

2 (Both)

DynamicPropertyAssociation

2 (Both)

DynamicPropertyInstance

2 (Both)

DynamicPropertyOptionSetItem

2 (Both)

Email

2 (Both)

EmailServerProfile

2 (Both)

Entitlement

2 (Both)

EntitlementChannel

2 (Both)

EntitlementTemplate

2 (Both)

EntitlementTemplateChannel

2 (Both)

Equipment

2 (Both)

ExchangeSyncIdMapping

2 (Both)

Fax

2 (Both)

FieldPermission

2 (Both)

FieldSecurityProfile

2 (Both)

FixedMonthlyFiscalCalendar

2 (Both)

Goal

2 (Both)

GoalRollupQuery

2 (Both)

HierarchyRule

2 (Both)

HierarchySecurityConfiguration

2 (Both)

Import

2 (Both)

ImportEntityMapping

2 (Both)

ImportFile

2 (Both)

ImportJob

2 (Both)

ImportMap

2 (Both)

Incident

2 (Both)

IncidentResolution

2 (Both)

Invoice

2 (Both)

InvoiceDetail

2 (Both)

IsvConfig

2 (Both)

KbArticle

2 (Both)

KbArticleComment

2 (Both)

KbArticleTemplate

2 (Both)

Lead

2 (Both)

Letter

2 (Both)

List

2 (Both)

LookUpMapping

2 (Both)

Mailbox

2 (Both)

MailMergeTemplate

2 (Both)

Metric

2 (Both)

MonthlyFiscalCalendar

2 (Both)

msdyn_PostAlbum

2 (Both)

msdyn_PostConfig

2 (Both)

msdyn_PostRuleConfig

2 (Both)

msdyn_wallsavedquery

2 (Both)

msdyn_wallsavedqueryusersettings

2 (Both)

Opportunity

2 (Both)

OpportunityClose

2 (Both)

OpportunityProduct

2 (Both)

OrderClose

2 (Both)

OrganizationUI

2 (Both)

OwnerMapping

2 (Both)

PhoneCall

2 (Both)

PickListMapping

2 (Both)

PluginAssembly

2 (Both)

PluginType

2 (Both)

Position

2 (Both)

Post

2 (Both)

PostComment

2 (Both)

PostFollow

2 (Both)

PostLike

2 (Both)

PriceLevel

2 (Both)

PrincipalObjectAttributeAccess

2 (Both)

ProcessSession

2 (Both)

ProcessTrigger

2 (Both)

Product

2 (Both)

ProductAssociation

2 (Both)

ProductPriceLevel

2 (Both)

ProductSubstitute

2 (Both)

Publisher

2 (Both)

PublisherAddress

2 (Both)

QuarterlyFiscalCalendar

2 (Both)

Queue

2 (Both)

QueueItem

2 (Both)

Quote

2 (Both)

QuoteClose

2 (Both)

QuoteDetail

2 (Both)

RecurrenceRule

2 (Both)

RecurringAppointmentMaster

2 (Both)

RelationshipRole

2 (Both)

RelationshipRoleMap

2 (Both)

Report

2 (Both)

ReportCategory

2 (Both)

ReportEntity

2 (Both)

ReportVisibility

2 (Both)

ResourceSpec

2 (Both)

Role

2 (Both)

RollupField

2 (Both)

RoutingRule

2 (Both)

RoutingRuleItem

2 (Both)

SalesLiterature

2 (Both)

SalesLiteratureItem

2 (Both)

SalesOrder

2 (Both)

SalesOrderDetail

2 (Both)

SavedQuery

2 (Both)

SavedQueryVisualization

2 (Both)

SdkMessageProcessingStep

2 (Both)

SdkMessageProcessingStepImage

2 (Both)

SdkMessageProcessingStepSecureConfig

2 (Both)

SemiAnnualFiscalCalendar

2 (Both)

Service

2 (Both)

ServiceAppointment

2 (Both)

ServiceEndpoint

2 (Both)

SharePointDocument

2 (Both)

SharePointDocumentLocation

2 (Both)

SharePointSite

2 (Both)

Site

2 (Both)

SLA

2 (Both)

SLAItem

2 (Both)

SLAKPIInstance

2 (Both)

SocialActivity

2 (Both)

SocialInsightsConfiguration

2 (Both)

SocialProfile

2 (Both)

Solution

2 (Both)

Subject

2 (Both)

SystemForm

2 (Both)

SystemUser

2 (Both)

Task

2 (Both)

Team

2 (Both)

TeamTemplate

2 (Both)

Template

2 (Both)

Territory

2 (Both)

TraceLog

2 (Both)

TransactionCurrency

2 (Both)

TransformationMapping

2 (Both)

TransformationParameterMapping

2 (Both)

UoM

2 (Both)

UoMSchedule

2 (Both)

UserEntityInstanceData

2 (Both)

UserEntityUISettings

2 (Both)

UserForm

2 (Both)

UserQuery

2 (Both)

UserQueryVisualization

2 (Both)

WebResource

2 (Both)

Workflow

2 (Both)

WorkflowDependency

2 (Both)

WorkflowLog

2 (Both)

繼承階層

System.Object
   Microsoft.Xrm.Sdk.OrganizationRequest
    Microsoft.Xrm.Sdk.Messages.CreateRequest

執行緒安全

此類型的任何公用靜態 (Visual Basic 中的 Shared) 成員都具備執行緒安全。任何執行個體成員都不保證具備執行緒安全。

平台

Development Platforms

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Target Platforms

Windows Server 2008、Windows Server 2012、Windows 7

Change History

請參閱

參照

CreateRequest 成員
Microsoft.Xrm.Sdk.Messages 命名空間
CreateResponse
IOrganizationService.Create 方法
Create a New Entity Record Using the Early-bound Entity Classes and the Organization Service Context

其他資源

Sample: Importing Files as Web Resources
Privileges by Entity

Send comments about this topic to Microsoft.
© 2015 Microsoft. All rights reserved.