コード例 #1
0
ファイル: Program.cs プロジェクト: yasirbhutta/docs
    void GetProfileInfo(CookieContainer cookieContainer)
    {
        string endPtAddr = strEndPtAddr("MyProfileSvcWrap");

        ProfileServiceClient profileSvc = new ProfileServiceClient(new BasicHttpBinding(),
                                                                   new EndpointAddress(endPtAddr));

        string[] strProfileProps = new string[] { "FirstName", "LastName", "PhoneNumber" };

        using (new OperationContextScope(profileSvc.InnerChannel)) {
            SetCookies(OperationContext.Current, cookieContainer);
            Dictionary <string, object> profileData =
                profileSvc.GetPropertiesForCurrentUser(strProfileProps, true);

            foreach (string sProp in strProfileProps)
            {
                Console.WriteLine(sProp + ": " + profileData[sProp]);
            }
        }
    }