Sharepoint的不是从Active Directory中获取当前用户的NetworkCredential [英] Sharepoint not getting current user NetworkCredential from active directory

查看:191
本文介绍了Sharepoint的不是从Active Directory中获取当前用户的NetworkCredential的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有奇怪的问题,我们有单点登录,我们正试图从Exchange Web服务EWS获取未读邮件数,但问题是它总是得到相同的计数,这实际上是服务器用户的所有用户。

 ',现在应该得到谁请求的页面当前用户
但它始终是服务器用户安装SharePoint哪里
公用Sub GetUnreadEmailCount()
    昏暗ERRORMSG作为字符串=的String.Empty
    昏暗UnreadCount为整数= 0
    昏暗的ESB作为新ExchangeServiceBinding    尝试
        esb.RequestServerVersionValue =新RequestServerVersion
        esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1
        esb.UseDefaultCredentials = TRUE
        esb.Url =域+/EWS/Exchange.asmx        ServicePointManager.ServerCertificateValidationCallback =新RemoteCertificateValidationCallback(AddressOf CertificateValidationCallBack)
        昏暗biArray(1)BaseFolderIdType
        昏暗dfFolder作为新DistinguishedFolderIdType
        dfFolder.Id = DistinguishedFolderIdNameType.inbox
        biArray(0)= dfFolder
        昏暗geGetFolder作为新GetFolderType
        geGetFolder.FolderIds = biArray
        geGetFolder.FolderShape =新FolderResponseShapeType
        geGetFolder.FolderShape.BaseShape = DefaultShapeNamesType.AllProperties
        昏暗gfResponse作为GetFolderResponseType = esb.GetFolder(geGetFolder)        昏暗rmta作为ResponseMessageType()= gfResponse.ResponseMessages.Items
        昏暗RMT作为FolderInfoResponseMessageType = DirectCast(rmta(0),FolderInfoResponseMessageType)
        如果rmt.ResponseClass = ResponseClassType.Success然后
            昏暗的文件夹FolderType = DirectCast(rmt.Folders(0),FolderType)
            UnreadCount = folder.UnreadCount        万一        Label1.Text = vbCrLf +未读邮件数:+ UnreadCount.ToString
        '返回UnreadCount
    抓住EX为例外
        如果没有ex.Message是Nothing然后ERRORMSG = ex.Message
        尝试
            如果没有ex.InnerException.Message是Nothing然后ERRORMSG = ERRORMSG +:+ ex.InnerException.Message
        卡子E作为例外        结束Try
    最后
        如果ESB状态并没有任何然后esb.Dispose():ESB =什么
        如果没有ERRORMSG =随后的String.Empty
            Label1.Text = vbCrLf +错误:+ ERRORMSG
        万一
    结束Try结束小组


解决方案

我们实际上有同样的问题,虽然我们没有使用单点登录。所以,我不知道这正是你正在经历。

问题是,你不能有一个用户在机器A 给自己的凭据为机器B (适用的SharePoint?),然后有机器B 发送到这些证书的计算机C

它被称为双合的问题,是一种安全功能,但我没有真正进入它的技术方面。我们的解决方案是使用Kerberos。

我希望这可以帮助你,如果不是,那它可以帮助你排除这个具体问题:)

we have strange problem, we have single signon and we are trying to fetch unread email count from Exchange ews webservice, the problem is it always gets same count for all user which is actually for server user.

'it should now get for current user who requested the page 
'but its always for server user where sharepoint is installed
Public Sub GetUnreadEmailCount()
    Dim errormsg As String = String.Empty
    Dim UnreadCount As Integer = 0
    Dim esb As New ExchangeServiceBinding

    Try
        esb.RequestServerVersionValue = New RequestServerVersion
        esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1
        esb.UseDefaultCredentials = True
        esb.Url = Domain + "/EWS/Exchange.asmx"

        ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf CertificateValidationCallBack)


        Dim biArray(1) As BaseFolderIdType
        Dim dfFolder As New DistinguishedFolderIdType
        dfFolder.Id = DistinguishedFolderIdNameType.inbox
        biArray(0) = dfFolder
        Dim geGetFolder As New GetFolderType
        geGetFolder.FolderIds = biArray
        geGetFolder.FolderShape = New FolderResponseShapeType
        geGetFolder.FolderShape.BaseShape = DefaultShapeNamesType.AllProperties
        Dim gfResponse As GetFolderResponseType = esb.GetFolder(geGetFolder)

        Dim rmta As ResponseMessageType() = gfResponse.ResponseMessages.Items
        Dim rmt As FolderInfoResponseMessageType = DirectCast(rmta(0), FolderInfoResponseMessageType)
        If rmt.ResponseClass = ResponseClassType.Success Then
            Dim folder As FolderType = DirectCast(rmt.Folders(0), FolderType)
            UnreadCount = folder.UnreadCount

        End If

        Label1.Text = vbCrLf + "Unread email count : " + UnreadCount.ToString
        ' Return UnreadCount
    Catch ex As Exception
        If Not ex.Message Is Nothing Then errormsg = ex.Message
        Try
            If Not ex.InnerException.Message Is Nothing Then errormsg = errormsg + " : " + ex.InnerException.Message
        Catch e As Exception

        End Try
    Finally
        If esb IsNot Nothing Then esb.Dispose() : esb = Nothing
        If Not errormsg = String.Empty Then
            Label1.Text = vbCrLf + "Error : " + errormsg
        End If
    End Try

End Sub

解决方案

We were actually having the same problem, although we were not using single sign on. So I'm not sure this is exactly what you are experiencing.

The problem is that you can not have a user on Machine A give their credentials to Machine B (SharePoint?) and then have Machine B send those credentials on to Machine C

It's referred to as the "Double Hop" problem and is a security feature, however I'm not really into the technical side of it. Our solution was to use Kerberos.

I hope this helps you, if not, that it helps you rule out this specific issue :)

这篇关于Sharepoint的不是从Active Directory中获取当前用户的NetworkCredential的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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