473,787 Members | 2,857 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sharepoint: Issue Adding SPUser to SPGroup FBA & Windows Auth

76 New Member
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 5564
Even I am geting same issue. Any solution?
Sep 29 '10 #2
RW5207
1 New Member
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
2034
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 environment without modification new to these products and not sure where to look for resource th dave
1
2899
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 checked on the site in IIS. My problem is that eventhough I am using LogonUser to log on to the server as the user, I am still getting the Windows Authentication Challenge (login window).
0
2281
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 recommended and b) if there is another way. I want to add the projects under the sharepoint site as I want authentication but do not want my users to have to login everytime they access a net app from within the sharepoint site. Ideally, they...
0
1713
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 sharepoint server so the user can access certain documents, etc. We want to change the web app to use ..NET forms authentication so we can get rid of the ugly windows prompt. My question is if using the forms based domain authentication will still...
6
2149
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 companyweb sharepoint site on Microsoft SBS 2003. I've tried various suggestions I've seen in other posts but no luck. I've also tried giving every single user/group full permissions to the directory and files but still no luck. The page works...
0
1533
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 demonstrates both in the same web.config and I don't like assuming i've done this correctly and securely. Please take a look at the following from my web.config and let me know what you think(its not the full config-- just stripped down to its...
0
1172
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 cms and sharepoint work. I tried to start working with my CMS project using VS .NET 2003. I got:
2
9106
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. Here is my code. sPAlert = sPUser.Alerts.Add(); sPAlert.AlertType = SPAlertType.List; sPAlert.AlertTemplate = sPAlertTemplate;
1
7843
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 methods for doing lookups. I could obviously write my own code that loops through each group, but I was wondering if there was an easier/cleaner way to accomplish this task. Thank you in advance, --
0
9497
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10169
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.