Added references:
- microsoft.crm.sdk.dll
- microsoft.crm.sdk.proxy.dll
- microsoft.xrm.sdk.dll
Errors i get:
Error 2 'CrmService' does not contain a definition for 'Url' and no extension method 'Url' accepting a first argument of type 'CrmService' could be found (are you missing a using directive or an assembly reference?)
Error 3 'CrmService' does not contain a definition for 'CrmAuthenticationTokenValue' and no extension method 'CrmAuthenticationTokenValue' accepting a first argument of type 'CrmService' could be found (are you missing a using directive or an assembly reference?)
Error 4 'CrmService' does not contain a definition for 'Credentials' and no extension method 'Credentials' accepting a first argument of type 'CrmService' could be found (are you missing a using directive or an assembly reference?)
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Security;
using System.Runtime.InteropServices;
using Microsoft.Crm.Sdk;
using System.Xml;
public partial class _Default : System.Web.UI.Page
{
public CrmService service;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void id_Click(object sender, EventArgs e)
{
string server = "192.168.1.50";
string domain = "domain";
string org = "organization";
string username = "user1\\crm.bdm";
string password = "user1secret";
NetworkCredential cred = new NetworkCredential();
cred.Domain = domain;
cred.UserName = username;
cred.Password = password;
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = org;
service = new CrmService();
service.Url = "http://192.168.1.50/airflights/XRMServices/2011/Organization.svc";
service.CrmAuthenticationTokenValue = token;
service.Credentials = cred;
cred = null;
}
public CrmService Service
{
get
{
return service;
}
}
}
What am I forgetting here ? Thanks.