我正在開發一個Windows 8.1商店應用,並且我希望獲得GAL並使用強大的外殼腳本添加GAL。當我試圖添加到System.Security.SecurityString referance它給出瞭如下錯誤..我試圖驗證與我的office365管理員的詳細信息,但它在構建應用程序時給出錯誤。使用powershell的Windows應用商店應用
「System.Management.Automation.PSCredential」不包含一個構造函數需要兩個參數
但它包含一個構造函數有兩個參數,相同的代碼工作得很好,當我建立一個Windows窗體應用程序。 Windows 8.1應用程序會出現什麼問題?
System.Uri psURL = new Uri("https://ps.outlook.com/powershell/");
System.Security.SecureString securePassword1 = safeString("test");
System.Management.Automation.PSCredential creds1 = new System.Management.Automation.PSCredential("test", securePassword1);
問題
1)是System.Security.SecurityString兼容Windows 8.1的應用程序或此錯誤PSCredential的未來,爲什麼,因爲當我刪除了SecureString的全球化志願服務青年的PSCredential的錯誤不會發生,但得到SecureString的錯誤失蹤像那樣?
2)是否有任何替代方法連接到沒有安全字符串的PowerShell的C#代碼?
我檢查了您的例子,並且它適合powershell腳本。但我需要在C#代碼中。對此有何幫助? – user5224152
你應該更具體 - Web或桌面應用程序?在此期間,您可能會發現一個解決方案[這裏](https://github.com/OfficeDev/O365API-PopulateSampleData) –
我正在開發的桌面應用程序。我看到你的鏈接,但它只有聯繫人,郵件和事件,但我需要GAL(全局地址列表)以及這就是爲什麼我試圖連接使用PowerShell。 – user5224152