从C#代码运行ps1时出错(Office 365) [英] Error running ps1 from c# code (Office 365)

查看:152
本文介绍了从C#代码运行ps1时出错(Office 365)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用office365中C#代码中的ps1文件创建共享点站点时.这个错误即将到来 在模块"Microsoft.Online.SharePoint.PowerShell"中找到"connect-sposervice"命令,但无法加载该模块.有关更多信息,请运行导入模块Microsoft.Online.SharePoint.PowerShell".

When creating the sharepoint site using ps1 file from C# code in office365. This error is coming The 'connect-sposervice' command was found in the module 'Microsoft.Online.SharePoint.PowerShell', but the module could not be loaded. For more information, run 'Import-Module Microsoft.Online.SharePoint.PowerShell'.

直接在powershell中运行ps1可以得到所需的结果,但不能使用c#代码正常工作

Running the ps1 directly in powershell is giving the desired result, but not working properly using c# code

推荐答案

我遇到了同样的问题,并以此方式解决了该问题:

I had the same problem and solve it this way:

查找文件

C:\ Program Files \ SharePoint Online命令行管理程序\ Microsoft.Online.SharePoint.PowerShell \ Microsoft.Online.SharePoint.PowerShell.psd1

并更改此行

# Processor architecture (None, X86, Amd64, IA64) required by this module
ProcessorArchitecture = 'Amd64'

为此:

# Processor architecture (None, X86, Amd64, IA64) required by this module
ProcessorArchitecture = 'X86'

我不知道这是否是一个很好的解决方案,但是对我来说有效. 任何建议都很好

I don't know if it's a good solution, but it's works for me. Any suggestion is wellcome

这篇关于从C#代码运行ps1时出错(Office 365)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆