Moss user configuration file and Its Management

Source: Internet
Author: User

In the previous article, we talked about the synchronization between the organizational hierarchy and AD. In fact, we can also take a deeper look at the user configuration details.

The moss shared service can help us save the so-called user configuration file. This information contains the following by default. The black bold text section can be edited.

  • Display name: ID, code name: userprofile_guid. Can I edit it? : False
  • Display name: Sid, code name: Sid. Can I edit it? : False
  • Display name: Active Directory ID, code name: adguid, can I edit it? : False
  • Display name: Account name, code name: accountname, can I edit it? : False
  • Display name: Last Name, code name: lastname. Can I edit it? : False
  • Display name: name, code name: firstname. Can I edit it? : False
  • Display name: name, code name: preferredname. Can I edit it? : False
  • Display name: Organization phone number, code name: workphone. Can I edit it? : False
  • Display name: office, code name: office. Can I edit it? : False
  • Display name: department, code name: Department. Can I edit it? : False
  • Display name: title, code name: title. Can I edit it? : False
  • Display name: Manager, code name: manager. Can I edit it? : False
  • Display name: Description, code name: aboutme. Can I edit it? : True
  • Display name: personal website, code name: personalspace. Can I edit it? : False
  • Display name: image, code name: pictureurl. Can I edit it? : True
  • Display name: User Name, code name: username. Can I edit it? : False
  • Display name: quick link and code name: Quicklinks. Can I edit it? : False
  • Display name: website, code name: website. Can I edit it? : False
  • Display name: public website redirection, code name: publicsiteredirect. Can I edit it? : False
  • Display name: non-direct manager, code name: SPS-dotted-line. Can I edit it? : False
  • Display name: Same level, code name: SPS-peers. Can I edit it? : False
  • Display name: responsibility, code name: SPS-responsibility. Can I edit it? : True
  • Display name: skill, code name: SPS-skills. Can I edit it? : True
  • Display name: previous project, code name: SPS-pastprojects. Can I edit it? : True
  • Display name: interest, code name: SPS-interests. Can I edit it? : True
  • Display name: School, code name: SPS-school. Can I edit it? : True
  • Display name: SIP address, code name: SPS-sipaddress. Can I edit it? : False
  • Display name: Birthday, code name: SPS-birthday, can I edit it? : True
  • Display name: My website upgrade, code name: SPS-mysiteupgrade, can I edit it? : True
  • Display name: "Not recommended" list, code name: SPS-dontsuggestlist. Can I edit it? : True
  • Display name: proxy server address, code name: SPS-proxyaddresses. Can I edit it? : False
  • Display name: employment date, code name: SPS-hiredate, can I edit it? : True
  • Display name: The last added colleague. Code name: SPS-lastcolleagueadded. Can I edit it? : True
  • Display name: Outlook Web Access URL, code name: SPS-owaurl, can I edit it? : True
  • Display name: Resource forest Sid, code name: SPS-resourcesid. Can I edit it? : False
  • Display name: Resource forest account name, code name: SPS-resourceaccountname, can you edit it? : False
  • Display name: main account name, code name: SPS-masteraccountname. Can I edit it? : False
  • Display name: Assistant, code name: assistant. Can I edit it? : True
  • Display name: Work email, code name: workemail, can I edit it? : False
  • Display name: Mobile Phone, code name: cellphone, can I edit it? : True
  • Display name: Fax, code name: Fax. Can I edit it? : True
  • Display name: residential phone number, code name: homephone, can I edit it? : True

 

So why do we need the so-called user configuration file? This mainly aims to share some settings across programs, such as the user's choice of website themes and colors.

In addition to the built-in attributes, you can also customize attributes.

This mechanism is similar to the profile mechanism built in ASP. NET. After adding the custom attributes, It is roughly as follows (note that the last line is added to the custom attributes)

So how can we retrieve these attributes in the code?

 

Using Microsoft. Office. server;
Using Microsoft. Office. server. administration;
Using Microsoft. Office. server. userprofiles;
Using Microsoft. SharePoint;

// The reference is Microsoft. Sharepoint. dll, Microsoft. Office. server.

Using (spsite site = new spsite (txtsite. Text) // if it is in a webpart, you can use spcontext. Current. Site to obtain the current site.
{
Servercontext context = servercontext. getcontext (SITE );
Userprofilemanager profiles = new userprofilemanager (context );

String useraccount = @ "xizhang \ Administrator ";
If (profiles. userexists (useraccount ))
{
USERPROFILE profile = profiles. getuserprofile (useraccount );
Foreach (Property in profiles. properties)
{

If (property! = NULL)
{
Richtextbox1.appendtext ("display name:" + property. displayname + ", code name:" + property. Name + ", can I edit it? : "+ Property. isusereditable +" \ n ");
}
}

}
}

Common scenarios, such

1. Read Manager

Profile ["manager"]. value. tostring ()

2. Read the email address

Profile ["workemail"]. value. tostring ()

 

 

The preceding Code reads attributes. How can I write attributes?

Profile ["color"]. value = "green ";
Profile. Commit ();

 

Note that if the information in AD is changed, it is not immediately reflected in the configuration file. Because the configuration file is not in combination with AD. You need to configure the import policy.

 

 

 

 

 

 

 

Summary of methods for reading Ad domain user information in Moss

In the moss environment, it is easy to read the specified attribute information of users in the ad domain after reading the information. The Code is as follows:

// Obtain the organizational unit (OU) required in the directory)
Public String gethomepagebygetallou (string curusername)
{
String AA = "/";
Directoryentry entry = new directoryentry ("LDAP: //" + domainname, "msdev \ Administrator", "123456! ", Authenticationtypes. Secure );
Directorysearcher mysearcher = new directorysearcher (entry );
Mysearcher. Filter = ("(objectclass = user )");

Foreach (searchresult resent in mysearcher. findall ())
{
If (resent. getdirectoryentry ()! = NULL & resent. getdirectoryentry (). properties ["samaccountname"]. value. tostring (). Trim () = curusername. Trim ())

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.