User Field type
-
Sorry, didn't realize that I didn't actually ask a question. My bad. :laugh: :laugh:
Ok, I guessed what do you want, but it would be good to describe the problem and what do you already did. :-\
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.
-
All my users are in AD.
Ok, next question is, if you have synchronized the user profile service with the ad. If it is synchronized all data is there. You just habe to read it:
using (SPSite Site = new SPSite(“Site URL”)) {
using (SPWeb Web = Site.OpenWeb()) {
SPList UserInfoList = Web.Lists[“User Information List”];
SPUser User = Web.Users.GetByID(1); – Put the User ID Here
SPListItem UserItem = UserInfoList.GetItemById(User.ID);
...
}
}You can read the Department with:
UserItem[“Department”]
Afterwards you read the "Job title" for all the Users in the department (same way) and look up the head of the deparment. Perhaps it's not in the job title but in another field, depending on how the information in the ad is filled. Well, so that how to do it with informations in the ad.
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.
-
Ok, next question is, if you have synchronized the user profile service with the ad. If it is synchronized all data is there. You just habe to read it:
using (SPSite Site = new SPSite(“Site URL”)) {
using (SPWeb Web = Site.OpenWeb()) {
SPList UserInfoList = Web.Lists[“User Information List”];
SPUser User = Web.Users.GetByID(1); – Put the User ID Here
SPListItem UserItem = UserInfoList.GetItemById(User.ID);
...
}
}You can read the Department with:
UserItem[“Department”]
Afterwards you read the "Job title" for all the Users in the department (same way) and look up the head of the deparment. Perhaps it's not in the job title but in another field, depending on how the information in the ad is filled. Well, so that how to do it with informations in the ad.
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.
I'm not trying read info (yet), I'm just trying to add to the list. So, here is what I'm using on the form:
<SharePoint:PeopleEditor ID="sppeManager" runat ="server" MultiSelect ="false" />
Here is my field:
And here was the code I was trying to use to insert the value from the form into the field:
Dim managerID As SPFieldUserValueCollection = New SPFieldUserValueCollection()
Dim manager As String = sppeManager.Entities(0).ToString
site.EnsureUser(manager)
Dim mgrAccount As SPUser = site.SiteUsers(manager)
Dim mgrID As New SPFieldUserValue(site, mgrAccount.ID, mgrAccount.LoginName)
managerID.Add(mgrID)
item(AccessRequest.ManagerCol) = managerIDBut, this isn't working at all. I just can't get anywhere and I can't find a reliable tutorial online to help me.
-
Ok, next question is, if you have synchronized the user profile service with the ad. If it is synchronized all data is there. You just habe to read it:
using (SPSite Site = new SPSite(“Site URL”)) {
using (SPWeb Web = Site.OpenWeb()) {
SPList UserInfoList = Web.Lists[“User Information List”];
SPUser User = Web.Users.GetByID(1); – Put the User ID Here
SPListItem UserItem = UserInfoList.GetItemById(User.ID);
...
}
}You can read the Department with:
UserItem[“Department”]
Afterwards you read the "Job title" for all the Users in the department (same way) and look up the head of the deparment. Perhaps it's not in the job title but in another field, depending on how the information in the ad is filled. Well, so that how to do it with informations in the ad.
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.
Also, I'm using this information to start a workflow.
-
I'm not trying read info (yet), I'm just trying to add to the list. So, here is what I'm using on the form:
<SharePoint:PeopleEditor ID="sppeManager" runat ="server" MultiSelect ="false" />
Here is my field:
And here was the code I was trying to use to insert the value from the form into the field:
Dim managerID As SPFieldUserValueCollection = New SPFieldUserValueCollection()
Dim manager As String = sppeManager.Entities(0).ToString
site.EnsureUser(manager)
Dim mgrAccount As SPUser = site.SiteUsers(manager)
Dim mgrID As New SPFieldUserValue(site, mgrAccount.ID, mgrAccount.LoginName)
managerID.Add(mgrID)
item(AccessRequest.ManagerCol) = managerIDBut, this isn't working at all. I just can't get anywhere and I can't find a reliable tutorial online to help me.
Aptiva Dave wrote:
I'm not trying read info (yet), I'm just trying to add to the list.
??? You try to read the Info and add it to the list. Therefore is the code I wrote. Fill the Field with an EventListener.
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.
-
Aptiva Dave wrote:
I'm not trying read info (yet), I'm just trying to add to the list.
??? You try to read the Info and add it to the list. Therefore is the code I wrote. Fill the Field with an EventListener.
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.
Well, that's going to be an issue because some people report to someone who isn't labeled as a manager in AD. This is because a) in some large departments it is just a title and doesn't really mean anything and b) IT doesn't usually get notified of when someone is made a manager or supervisor so that we can make the changes in AD nor do our users usually make use of the tools we have given them to make the changes themselves. So, since all I can rely on AD for is their user account and email address, I would like to have the people picker on the form to allow the user to at least find their manager's name and let the site handle the rest. I hope that makes sense.
-
Well, that's going to be an issue because some people report to someone who isn't labeled as a manager in AD. This is because a) in some large departments it is just a title and doesn't really mean anything and b) IT doesn't usually get notified of when someone is made a manager or supervisor so that we can make the changes in AD nor do our users usually make use of the tools we have given them to make the changes themselves. So, since all I can rely on AD for is their user account and email address, I would like to have the people picker on the form to allow the user to at least find their manager's name and let the site handle the rest. I hope that makes sense.
Ok, you just want to have a field, where the User of the form can put in the one, who is manager, right? There are different solutions. 1. You go a different way and build a list of managers for each department 2. You let the user enter a name in a normal user-field 3. You fill a dropdownbox with all users of the department, so that the selection is smaler (for this case you can use the code I wrote before, just that you add every member of the department to the dropdownbox). Hope, there is a solutions suitable for you.
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.
-
Ok, you just want to have a field, where the User of the form can put in the one, who is manager, right? There are different solutions. 1. You go a different way and build a list of managers for each department 2. You let the user enter a name in a normal user-field 3. You fill a dropdownbox with all users of the department, so that the selection is smaler (for this case you can use the code I wrote before, just that you add every member of the department to the dropdownbox). Hope, there is a solutions suitable for you.
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.
Well, the big wrinkle is that we have anonymous access on the site and don't allow users to log in, so that is why I was going to used the People editor control so the user could find their manager's name from our AD environment.
-
Ok, I guessed what do you want, but it would be good to describe the problem and what do you already did. :-\
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.
Which version sharepoint are you using, 2007 or 2010? www.jadesum.com
-
Which version sharepoint are you using, 2007 or 2010? www.jadesum.com
SharePoint 2010 :-\
------------------------------ Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.