SPMobileMessageSmsBuilder 该服务提供商不支持短信 The ServiceProvider does not support SMS

Sharepoint短信服务证书更新后,发短信报异常:该服务提供商不支持短信;

image

通过Reflector查看SPMobileMessageSmsBuilder类,最后发现是SPMobileMessagingAccount account.ServiceProvider属性为空,很神奇,不知道是不是我的OMS服务写得有问题,不过用OutLooK发送一直是正常的:

   1: public SPMobileSmsMessage(SPMobileMessagingAccount account) : base(account, SPMobileMessage.Format.SMS, SPMobileMessage.RequiredService.SMS_SENDER)
   2: {
   3:     if ((base.Account.ServiceProvider == null) || (base.Account.ServiceProvider.SmsSender == null))
   4:     {
   5:         throw new SPException(SPResource.GetString("ServiceProviderNotSupportSMS", new object[0]));
   6:     }
   7:     this.m_Splitter = new MessageSplitter(this.SmsSender);
   8: }

解决方案:

写控制台程序,手动更新ServiceProvider: account.UpdateServiceProvider();

代码如下:

   1: SPWebApplication webApp = site.WebApplication;
   2: SPMobileMessagingAccount account = webApp.OutboundSmsServiceAccount;
   3: account.UpdateUserInfo();
   4: account.UpdateServiceProvider();
   5:                
   6: SPSecurity.RunWithElevatedPrivileges(delegate()
   7: {
   8:     webApp.UpdateSmsAccount(account);
   9:     webApp.Update();
  10: });

2013-01-12可能的原因:

在修改了OMS后,再一次出现上文的问题,反复测试后发现:

在设置完服务器场的移动帐户后,又手贱在Web 应用程序中设置了一遍移动帐户,而这里可能有BUG,系统没有去调用OMS的GetServiceInfo(),也就不会生成ServiceProvider,我没在管理中心找到让Web应用程序重新继承服务器场移动账号的设置页面,只能又运行了一遍上面的代码。。。

原文地址:https://www.cnblogs.com/ruijian/p/2467631.html