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

定制网站和模板网站自己做网站 怎么赚钱

定制网站和模板网站,自己做网站 怎么赚钱,素材模板网站,网站架构的建设一、背景说明 在已有的项目中#xff0c;已经获取到了Graph的AccessToken并保存在内存里面。所以不希望再通过client secret或者certificate去创建GraphServiceClient对象。希望使用现有的token字符串来创建初始化创建GraphServiceClient从而来实现Graph其他API功能。 二、具体…一、背景说明 在已有的项目中已经获取到了Graph的AccessToken并保存在内存里面。所以不希望再通过client secret或者certificate去创建GraphServiceClient对象。希望使用现有的token字符串来创建初始化创建GraphServiceClient从而来实现Graph其他API功能。 二、具体实现 2.1 需要Java Graph SDK依赖 加入到pom.xml文件内 !-- Microsoft Graph SDK for Java --dependencygroupIdcom.microsoft.graph/groupIdartifactIdmicrosoft-graph/artifactIdversion[5.0,)/version/dependency!-- Azure AD Authentication SDK for Java --dependencygroupIdcom.azure/groupIdartifactIdazure-identity/artifactIdversion[1.3,)/version/dependency 2.2 代码片段 public static GraphServiceClient initGraphServiceClient() {IAuthenticationProvider authProvider new IAuthenticationProvider() {Overridepublic CompletableFutureString getAuthorizationTokenAsync(URL requestUrl) {CompletableFutureString future new CompletableFuture();future.complete(Your_AccessToken);return future;}};return GraphServiceClient.builder().authenticationProvider(authProvider).buildClient();} 三、测试 下面代码是实现调用创建GraphServiceClient调用graph api发送带附件的邮件。 public static String sendMail() {try {String mfrom xxxxoutlook.com;String to xxxxoutlook.com;GraphServiceClientRequest graphClient initGraphServiceClient();Message message new Message();message.subject Meet for lunch?;ItemBody body new ItemBody();body.contentType BodyType.TEXT;body.content The new cafeteria is open.;message.body body;LinkedListRecipient toRecipientsList new LinkedListRecipient();Recipient toRecipients new Recipient();EmailAddress emailAddress new EmailAddress();emailAddress.address to;toRecipients.emailAddress emailAddress;toRecipientsList.add(toRecipients);message.toRecipients toRecipientsList;// 构建附件LinkedListAttachment attachmentsList new LinkedListAttachment();FileAttachment attachments new FileAttachment();attachments.name hello word.txt;attachments.oDataType #microsoft.graph.fileAttachment;attachments.contentType text/plain;attachments.contentBytes Base64.getDecoder().decode(SGVsbG8gV29ybGQh);attachmentsList.add(attachments);AttachmentCollectionResponse attachmentCollectionResponse new AttachmentCollectionResponse();attachmentCollectionResponse.value attachmentsList;AttachmentCollectionPage attachmentCollectionPage new AttachmentCollectionPage(attachmentCollectionResponse, null);message.attachments attachmentCollectionPage;// 以指定用户邮箱发送邮件graphClient.users(mfrom).sendMail(UserSendMailParameterSet.newBuilder().withMessage(message).withSaveToSentItems(true).build()).buildRequest().post();log.info(send email success);return success;} catch (Exception e) {e.printStackTrace();log.error(send email error : {}, e.getMessage());return e.getMessage();}}
http://www.w-s-a.com/news/350101/

相关文章:

  • 网站的页面由什么组成淘宝网网站建设的需求分析
  • 软文网站推广法dede5.7内核qq个性门户网站源码
  • 个人备案网站名称校园网站建设特色
  • vr超市门户网站建设班级网站怎么做ppt模板
  • 网站建设一般是用哪个软件刚开始做写手上什么网站
  • 用jsp做的网站源代码下载有哪些做红色旅游景点的网站
  • 网站开发的技术选型黄石市网站建设
  • 做直播网站需要证书吗专做宝宝的用品网站
  • 网站标题用什么符号网站制作交易流程
  • dede模板网站教程jsp网站搭建
  • 上海网站开发外包公司鲜花导购网页制作
  • 宿州外贸网站建设公司个人注册网站一般做什么
  • 小公司做网站用哪种服务器什么是网站代理
  • 青岛李村网站设计公司cms建站平台
  • 做saas网站可行吗许昌抖音推广公司
  • 网站建设找谁做seo基础知识培训
  • 微网站怎么做的好建设网站不会写代码
  • 广州外贸网站制作wordpress信息搜索插件
  • 福建高端网站建设个人公众号怎么制作教程
  • 企业网站有哪些举几个例子wordpress ie兼容插件
  • 高端的深圳网站页面设计福清市建设局官方网站
  • 安装网站到服务器合肥建设干部学校网站
  • 影视网站如何做销售案例网站
  • 建设网站对比方案龙岗网站开发公司
  • 网站开发标准网站建设公司兴田德润可信赖
  • 如何建设一个公众号电影网站自动seo优化
  • 个人网站能备案吗酱香拿铁采取了哪些网络营销方式
  • 网站建设及推广好做吗自己做的网站加入购物车价格
  • 涡阳在北京做网站的名人注册一个免费的网站
  • 三门峡建设环境局网站公司注册网上核名通道