질문하기질문하기
 

답변됨Check if valid user

  • 2009년 7월 4일 토요일 오전 7:07SamCosta 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hi Everyone,

    I am developing a console app that iterates through a list of usernames from our HR system and updates user properties for users that exist in WSS 3.0.  I'm running into an issue where I am unable to check if the username is a valid SharePoint user first before entering the loop.  When I do this:  SPWeb.AllUsers("USERNAME") it throws an exception if the username is invalid.  Is there a method in the SDK that checks if the user exists?  I tried EnsureUser however I do want to create a user if it does exist.

    Thank You

답변

  • 2009년 7월 4일 토요일 오후 4:13Sébastien Sougnez 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    Hello,

    I already had this issue. Actually, the only solution that I found is to nest you statement (SPWeb.AllUser) with a try ... catch. If the user doesn't exist, the catch is raised, otherwise, I can excecute some code...
    http://www.areaprog.com
    • 답변으로 표시됨SamCosta 2009년 8월 30일 일요일 오후 5:50
    • 답변으로 제안됨Sébastien Sougnez 2009년 7월 4일 토요일 오후 6:59
    •  

모든 응답

  • 2009년 7월 4일 토요일 오후 4:13Sébastien Sougnez 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    Hello,

    I already had this issue. Actually, the only solution that I found is to nest you statement (SPWeb.AllUser) with a try ... catch. If the user doesn't exist, the catch is raised, otherwise, I can excecute some code...
    http://www.areaprog.com
    • 답변으로 표시됨SamCosta 2009년 8월 30일 일요일 오후 5:50
    • 답변으로 제안됨Sébastien Sougnez 2009년 7월 4일 토요일 오후 6:59
    •  
  • 2009년 7월 4일 토요일 오후 5:49SamCosta 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Thanks for your response.  That is exactly what I am doing today, I guess I'll have to stick with it.
  • 2009년 7월 6일 월요일 오전 11:27kesav7902 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    i dont  think u need to loop it around..try checking the username with the domain included.

    lets be optimistic.....
  • 2009년 7월 6일 월요일 오후 2:18SamCosta 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    How do I check the username? I am posting this question here because I cannot find a way to check.
  • 2009년 8월 27일 목요일 오후 6:32AWMM 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hi,

    Did you ever find out if there was another way to check if the user exists besides using a try/catch?