public string GetAccessToken()
{
_oauth.Token = Application["auth_token"].ToString();
_oauth.TokenSecret = Application["auth_tokensecret"].ToString();
_oauth.Verifier = Application["auth_verifier"].ToString();
_oauth.AccessTokenGet(Application["auth_token"].ToString());
//string oauth_access = Application["auth_token"].ToString();
Application["oauth_access"] = _oauth.Token;//Application["oauth_token"].ToString();
//string oauth_access_secret = Application["auth_tokensecret"].ToString(); oauth_token_secret
Application["oauth_access_secret"] = _oauth.TokenSecret; //Application["oauth_token_secret"].ToString();
ClientCredentials Credentials = new ClientCredentials();
Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
//This URL needs to be updated to match the servername and Organization for the environment.
Uri OrganizationUri = new Uri("http://<crmserver>/<organization name>/XRMServices/2011/Organization.svc");
Uri HomeRealmUri = null;
//OrganizationServiceProxy serviceProxy;
using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri, Credentials, null))
{
IOrganizationService service = (IOrganizationService)serviceProxy;
//Instantiate the contact object and populate the attributes.
Entity new_cooldrink = new Entity("new_cooldrink");
//Entity Contact = new Entity("contact");
new_cooldrink["new_name"] = Application["oauth_access"].ToString();//TextBox1.Text.ToString();//txtFirstName.Text.ToString();
//contact["lastname"] = txtLastName.Text.ToString();
//contact["emailaddress1"] = txtEmailAddress.Text.ToString();
//contact["telephone1"] = txtPhoneNumber.Text.ToString();
Guid newnew_cooldrinkid = service.Create(new_cooldrink);
//This code will clear the textboxes after the contact is created.
//TextBox1.Text = "";
}
return _oauth.Verifier;
}
{
_oauth.Token = Application["auth_token"].ToString();
_oauth.TokenSecret = Application["auth_tokensecret"].ToString();
_oauth.Verifier = Application["auth_verifier"].ToString();
_oauth.AccessTokenGet(Application["auth_token"].ToString());
//string oauth_access = Application["auth_token"].ToString();
Application["oauth_access"] = _oauth.Token;//Application["oauth_token"].ToString();
//string oauth_access_secret = Application["auth_tokensecret"].ToString(); oauth_token_secret
Application["oauth_access_secret"] = _oauth.TokenSecret; //Application["oauth_token_secret"].ToString();
ClientCredentials Credentials = new ClientCredentials();
Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
//This URL needs to be updated to match the servername and Organization for the environment.
Uri OrganizationUri = new Uri("http://<crmserver>/<organization name>/XRMServices/2011/Organization.svc");
Uri HomeRealmUri = null;
//OrganizationServiceProxy serviceProxy;
using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri, Credentials, null))
{
IOrganizationService service = (IOrganizationService)serviceProxy;
//Instantiate the contact object and populate the attributes.
Entity new_cooldrink = new Entity("new_cooldrink");
//Entity Contact = new Entity("contact");
new_cooldrink["new_name"] = Application["oauth_access"].ToString();//TextBox1.Text.ToString();//txtFirstName.Text.ToString();
//contact["lastname"] = txtLastName.Text.ToString();
//contact["emailaddress1"] = txtEmailAddress.Text.ToString();
//contact["telephone1"] = txtPhoneNumber.Text.ToString();
Guid newnew_cooldrinkid = service.Create(new_cooldrink);
//This code will clear the textboxes after the contact is created.
//TextBox1.Text = "";
}
return _oauth.Verifier;
}
No comments:
Post a Comment