473,387 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Sharepoint: Issue Adding SPUser to SPGroup FBA & Windows Auth

76
Foreword: Our Sharepoint site runs off both Forms Based and Windows Authentication. That being said some users have dual accounts for both methods of authentication...but not all users. Each account has unique ID's but runs off different SSPs.

Problem: Currently working on a tool that one piece (the one I need help with) is having issues adding users to a specified SharePoint group. I am getting a legitimate SPUser but when I try to add that SPUser to the SPGroup it throws an error whenever that SPUser is an AD SPUser as opposed to one from the Forms-Based Authentication.

Expand|Select|Wrap|Line Numbers
  1.     protected void AddUserToGroup(string strUserName)
  2.     {
  3.       SPWeb oWeb = SPContext.Current.Web;
  4.       SPUser oUser = getSPUser(strUserName);
  5.       if (oUser != null)
  6.       {
  7.         oWeb.AllowUnsafeUpdates = true;
  8.         SPGroup oCurrentGroup = oWeb.Groups[gstrListGroup];
  9.         lblStatus.Text += oUser.Name + ": ";
  10.         try
  11.         {
  12.           oCurrentGroup.AddUser(oUser);
  13.           lblStatus.Text += "Complete<br>";
  14.         }
  15.         catch (Exception)
  16.         {
  17.           lblStatus.Text += "Error occured. Please check the name or add the user via the Sharepoint Group<br>";
  18.         }
  19.         finally
  20.         {
  21.           oCurrentGroup.Update();
  22.         }
  23.         oWeb.AllowUnsafeUpdates = false;
  24.       }
  25.     }
  26.  
I have also tried to hard-code manually add the AD account and I still get the error. It tells me that the user is not unique or does not exist which does not make any sense to me because when I go to SharePoint directly I see the SPUser, I see their properties and their unique ID.

Could this possibly be a case where if the user may no longer exist in AD but still has a SharePoint account that they may be throwing this error?
Oct 15 '09 #1
2 5542
Even I am geting same issue. Any solution?
Sep 29 '10 #2
RW5207
1
Did you ever figure this out? I'm using PowerShell and getting a similar result: Set-SPUser : The user does not exist or is not unique.
Dec 21 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: dave | last post by:
if i created a web part in vs.net like http://www.devx.com/dotnet/Article/17518/0/page/2 is it possible to use the web part in both the sharepoint services environment and the sharepoint portal...
1
by: Rich | last post by:
I am running IIS6 on a Win2k3 server. I have an ASP.Net app (C#) that a user logs into and then I use LogonUser to validate them and log them onto the server. I have Windows Authentication ONLY...
0
by: Ken Wigle | last post by:
All, I am trying to add some .net applications I wrote to a virtual directory underneath the sharepoint services web site. I am having some problems and wondering if a) this is possible and/or...
0
by: chrisnet | last post by:
We use a .NET web application on one server that is using basic integrated authentication and therefore getting the windows prompt for domain credentials. These credentials are then passed to a...
6
by: Michael S | last post by:
Not sure if I'm posting in the right group but here goes. I am getting the following error when trying to browse to an .aspx page which I have set up in a virtual directory under the default...
0
by: Chris Mohan | last post by:
Hi, I've configured a web app to use windows authentication and also set up two separate subdirectories to use forms authentication. It appears to work fine but I have never seen a sample that...
0
by: laks | last post by:
I had installed windows 2003, then wss, then vs .net and then cms 2002 sp1a std ed. The applicatino pool was set by default is spsAppPool1. CMS was not working. I installed connector and both...
2
by: kashif | last post by:
Hello All, I am trying to crete alerts using SharePoint V3 API and so far I am able to create alerts but for some reason I could not figure out how to set AlertTemplate property on SPAlert object....
1
by: Fao, Sean | last post by:
I was wondering if there was any way to programmatically determine whether or not a group exists in SharePoint. I checked the SPGroupCollection in the SPWeb.SiteGroups property and didn't see any...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.