问题
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