Error running ps1 from c# code (Office 365)

喜夏-厌秋 提交于 2019-12-25 02:13:43

问题


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'.

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


回答1:


I had the same problem and solve it this way:

Locate file

C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.Online.SharePoint.PowerShell.psd1

and change this line

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

for this one:

# 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



来源:https://stackoverflow.com/questions/22346107/error-running-ps1-from-c-sharp-code-office-365

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!