当前位置: 首页 > news >正文

镇江网站seo外包有哪些网站是可以做宣传的

镇江网站seo外包,有哪些网站是可以做宣传的,明港网站建设公司,广州建设工程交易中心怎么样微软动态CRM专家罗勇 #xff0c;回复332或者20190505可方便获取本文#xff0c;同时可以在第一间得到我发布的最新博文信息#xff0c;follow me#xff01; 本文很多内容来自 John Towgood 撰写的Dynamics 365 Online Authenticate with Client Credentials #xff0c…微软动态CRM专家罗勇 回复332或者20190505可方便获取本文同时可以在第一间得到我发布的最新博文信息follow me 本文很多内容来自 John Towgood 撰写的Dynamics 365 Online Authenticate with Client Credentials 也着重参考了官方的 Use Single-Tenant server-to-server authentication 我根据新的Azure Portal界面做了一些操作上的变化并且改了一些代码还使用ADAL来简化代码。 登录 https://portal.azure.com 点击左边的 【Azure Active Directory】 然后再点击 【App registrations】 再点击【New registration】 输入一个合适的名称Supported account types保持默认的 Accounts in this organizational directory only (Orgname) 不变点击【Register】按钮。因为Redirect URI用不上所以不输入。 注册成功后会产生 Application (client) ID记录下来备用同时也记录下 Directory (tenant) ID。 再点击左边的【API Permissions】再点击右边的 【 Add a permission】按钮。 选择 【Dynamics CRM】  (也可以选择使用 PowerApps Runtime Serive 这个权限) 选择 【Delegated permissions】 【user_impersonation】后点击【Add permissions】按钮。 然后点击【Grant admin consent for Orgname】 在弹出的提示中选择【Yes】。 然后点击【Certificates secrets】 【 New client secret】输入合适的Description在点击【Add】按钮。 会自动生成Client secrets这里需要点击生成的secret旁边的【copy to clipboard】图标将其复制下来记得在这个步骤复制下来因为离开这个页面后就看不到这个secret了。 然后需要创建 一个Azure AD 用户点击左侧的【Azure Active Directory】 【Users】。 然后点击【New user】。 为用户输入NameUser Name然后点击【Create】按钮。 最后还需要到Dynamics 365 Customer Engagement中创建一个Application User。导航到 Settings Security Users切换到【Application Users】点击命令栏的【NEW】按钮。 记得要切换到 APPLICATION USER这个窗体输入的内容如下Application ID就是前面步骤记录的Application (client) ID其余的就是前面步骤创建的Azure AD user信息。 保存后会自动填充 Application ID URI 和 Azure AD Object ID 字段的值。 当然还需要给这个用户授予至少一个角色才行官方建议不要授予系统标准角色我这里复制了一个标准角色授予给他。 如果用Postman来获取access token的话如下图 下面就是用代码如何做了不多说看代码 using Newtonsoft.Json;using System;using System.Collections.Generic;using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks; namespace UsingWebAPI{public class AuthenticationResponse{public string access_token { get; set; }public int expires_in { get; set; }public int expires_on { get; set; }public int ext_expires_in { get; set; }public int not_before { get; set; }public string resource { get; set; }public string token_type { get; set; }}class Program{ static string resourceUrl https://crm219270.crm5.dynamics.com/;static string clientId de8dd947-a3e3-48ec-8602-c3063f11dc29;static string clientSecret 5FsXh2*oNyLRm]Go1a9hD.[]k54GNOZ;static string tenantId 3e28b187-1c5c-42f5-a1be-3f47570da35d; static void Main(string[] args){GetAuthenticationResponse();Console.ReadKey();} private static async void GetAuthenticationResponse(){ListKeyValuePairstring, string vals new ListKeyValuePairstring, string(); vals.Add(new KeyValuePairstring, string(client_id, clientId));vals.Add(new KeyValuePairstring, string(resource, resourceUrl));vals.Add(new KeyValuePairstring, string(grant_type, client_credentials));vals.Add(new KeyValuePairstring, string(client_secret, clientSecret));string tokenUrl string.Format(https://login.windows.net/{0}/oauth2/token, tenantId); using (HttpClient httpClient new HttpClient()){httpClient.DefaultRequestHeaders.Add(Cache-Control, no-cache);HttpContent content new FormUrlEncodedContent(vals);HttpResponseMessage hrm httpClient.PostAsync(tokenUrl, content).Result;AuthenticationResponse authenticationResponse null;if (hrm.IsSuccessStatusCode){string data await hrm.Content.ReadAsStringAsync();authenticationResponse JsonConvert.DeserializeObjectAuthenticationResponse(data);await DataOperations(authenticationResponse);}else{Console.WriteLine(Error. hrm.ReasonPhrase);}}} private static async Task DataOperations(AuthenticationResponse authResult){using (HttpClient httpClient new HttpClient()){httpClient.BaseAddress new Uri(resourceUrl);httpClient.Timeout new TimeSpan(, , ); //2 minuteshttpClient.DefaultRequestHeaders.Add(OData-MaxVersion, 4.0);httpClient.DefaultRequestHeaders.Add(OData-Version, 4.0);httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(application/json));httpClient.DefaultRequestHeaders.Authorization new AuthenticationHeaderValue(Bearer, authResult.access_token);string content JsonConvert.SerializeObject(new { name A Account, telephone1 });HttpRequestMessage request new HttpRequestMessage(HttpMethod.Post, api/data/v9.1/accounts);request.Content new StringContent(content);request.Content.Headers.ContentType MediaTypeHeaderValue.Parse(application/json);HttpResponseMessage response await httpClient.SendAsync(request);if (response.IsSuccessStatusCode){Console.WriteLine(Account created.);}else{Console.WriteLine(String.Format(Failed to create account, reason is {0}., response.ReasonPhrase));}}}}} 当然如果使用ADAL的话代码会更加简单点 using Microsoft.IdentityModel.Clients.ActiveDirectory;using Newtonsoft.Json;using System;using System.Net.Http;using System.Net.Http.Headers; namespace UsingWebAPI{class Program{ static string resourceUrl https://crm219270.crm5.dynamics.com/;static string clientId de8dd947-a3e3-48ec-8602-c3063f11dc29;static string clientSecret 5FsXh2*oNyLRm]Go1a9hD.[]k54GNOZ;static string tenantId 3e28b187-1c5c-42f5-a1be-3f47570da35d; static void Main(string[] args){AuthAndInvoke();Console.ReadKey();} private static async void AuthAndInvoke(){var credentials new ClientCredential(clientId, clientSecret);var authContext new AuthenticationContext(https://login.microsoftonline.com/ tenantId);var result await authContext.AcquireTokenAsync(resourceUrl, credentials);using (HttpClient httpClient new HttpClient()){httpClient.BaseAddress new Uri(resourceUrl);httpClient.Timeout new TimeSpan(, , ); //2 minuteshttpClient.DefaultRequestHeaders.Add(OData-MaxVersion, 4.0);httpClient.DefaultRequestHeaders.Add(OData-Version, 4.0);httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(application/json));httpClient.DefaultRequestHeaders.Authorization new AuthenticationHeaderValue(Bearer, result.AccessToken);string content JsonConvert.SerializeObject(new { name A Account, telephone1 });HttpRequestMessage request new HttpRequestMessage(HttpMethod.Post, api/data/v9.1/accounts);request.Content new StringContent(content);request.Content.Headers.ContentType MediaTypeHeaderValue.Parse(application/json);HttpResponseMessage response await httpClient.SendAsync(request);if (response.IsSuccessStatusCode){Console.WriteLine(Account created.);}else{Console.WriteLine(String.Format(Failed to create account, reason is {0}., response.ReasonPhrase));}}}}} 可以看到代码创建的account的owner是我们前面步骤的Application User是以该用户身份在运行的。
http://www.sadfv.cn/news/83926/

相关文章:

  • 宝塔面板怎么建设网站淮安网站制作多少钱
  • 做h的游戏视频网站淘客二级域名网站免费建设
  • 网站开发直播软件wordpress 后台演示
  • 湖北城市建设职业技术学院教务网站做软件跟做网站哪个难
  • 移动广告公司网站建设流量宝官网
  • 深圳住房和建设局网站在哪个网网站页头设计
  • 河源哪有做网站电商企业网页设计
  • 专业做网站设计公司价格潍坊网络推广
  • 中国建材信息总网佛山网站优化建设
  • 自己做网站可以随便起名字吗城乡建设学校官方网站
  • jsp 网站开发教程wordpress建站后
  • 做网站就业要会什么百丽优购物官方网站
  • wordPress主题模板站wordpress 前端会员中心
  • 团支部智慧团建网站搜索引擎营销的主要模式有哪些
  • 微网站内页百度在线扫题入口
  • 通过apache建设网站进入qq空间登录
  • 郴州网站设计公司WordPress十大免费CMS主题
  • 百度不到公司网站电脑装wordpress
  • 惠州百优做网站小程序熊掌号工业园做网站的公司
  • dns看国外网站网页设计作业成品代码啊
  • 丹徒网站建设策划html教程 it教程网
  • 安远网站制作盘锦做网站
  • 玄武网站建设成都网站建设:思乐科技
  • 做网赌网站怎么推广公司招聘网站 哪个部门做
  • ftp上传网站之后网络舆情分析报告
  • 太原自学网站建设现在用什么做网站
  • 创建一个网站需要做哪些工作北湖区网站建设哪家好
  • 我有云服务器如何建站做网站通过什么赚钱吗
  • 广西省建设厅官方网站广州市网站制作服务公司
  • 凡科建站小程序制作兰州网站建设技能论文