Click here to Skip to main content
15,895,142 members
Articles / Web Development / ASP.NET

Update SharePoint UserInfo List with More Active Directory Info

Rate me:
Please Sign up or sign in to vote.
4.45/5 (5 votes)
19 Mar 2009CPOL2 min read 59.7K   371   16  
Shows how to write a job that updates the UserInfo list with more Active Directory information.
<%@ Assembly Name="Microsoft.SharePoint"  %>
<%@Master language="C#" Inherits="Microsoft.SharePoint.WebControls.DialogMaster"%>
<%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="LinksTable" src="/_controltemplates/LinksTable.ascx" %> <%@ Register TagPrefix="wssuc" TagName="InputFormSection" src="/_controltemplates/InputFormSection.ascx" %> <%@ Register TagPrefix="wssuc" TagName="InputFormControl" src="/_controltemplates/InputFormControl.ascx" %> <%@ Register TagPrefix="wssuc" TagName="LinkSection" src="/_controltemplates/LinkSection.ascx" %> <%@ Register TagPrefix="wssuc" TagName="ButtonSection" src="/_controltemplates/ButtonSection.ascx" %> <%@ Register TagPrefix="wssuc" TagName="ActionBar" src="/_controltemplates/ActionBar.ascx" %> <%@ Register TagPrefix="wssuc" TagName="ToolBar" src="/_controltemplates/ToolBar.ascx" %> <%@ Register TagPrefix="wssuc" TagName="ToolBarButton" src="/_controltemplates/ToolBarButton.ascx" %> <%@ Register TagPrefix="wssuc" TagName="Welcome" src="/_controltemplates/Welcome.ascx" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %>
<html dir= "<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,multipages_direction_dir_value%>' EncodeMethod='HtmlEncode'/>" >
<head runat="server">
	<meta name="generator" content="Microsoft SharePoint">
	<meta http-equiv="content-type" content="text/html" charset="utf-8">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="pragma" content="no-cache">
	<Title ID=onetidTitle><asp:ContentPlaceHolder id=PlaceHolderDialogHeaderPageTitle runat="server"/></Title>
	<SharePoint:CssLink runat="server"/>
	<SharePoint:Theme runat="server"/>
	<SharePoint:ScriptLink language="javascript" name="core.js" runat="server" />
	<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server"/>
</head>
<script language="javascript">
function showWaitCursor(fIsOK)
{
	if(document.all)
	{
		for (var i=0; i<document.all.length; i++)
		{
			document.all(i).style.cursor="wait";
		}
		return true;
	}
}
function checkForEsc(e)
{
	if(!e) e = window.event;
		var key = e.keyCode;
		if(key==27)
			doCancel();
}
function disableOK()
{
	var ok=(document.getElementById("<%= this.OkButton.ClientID %>"));
	ok.disabled=true;
}
function enableOK()
{
	var ok=(document.getElementById("<%= this.OkButton.ClientID %>"));
	ok.disabled=false;
}
function doCancel()
{
	window.parent.close();
}
function setSize()
{
	var tbl=document.getElementById('mainTable');
	window.parent.w=tbl.offsetWidth;
	window.parent.h=tbl.offsetHeight;
}
function onResize()
{
	var headingRow = document.getElementById("headingRow");
	var headingDivider = document.getElementById("headingDivider");
	var bodyRow = document.getElementById("bodyRow")
	var bodyHeader = document.getElementById("bodyHeader")
	var bodyTableCell = document.getElementById("bodyTableCell")
	var bodyMain = document.getElementById("bodyMain")
	var bodyFooter = document.getElementById("bodyFooter")
	var buttonRow = document.getElementById("buttonRow")
	var bodyOtherThanMainOffsetHeight = bodyMain.offsetHeight;
	if(bodyRow)
	{
		bodyOtherThanMainOffsetHeight = bodyRow.offsetHeight - bodyMain.offsetHeight;
	}
	bodyMain.style.overflow = "auto";
	var ConstMinBodyMainHeight = 50;
	var ConstMinBodyMainWidth = 200;
	var newHeight = document.body.clientHeight - headingRow.offsetHeight - headingDivider.offsetHeight - bodyHeader.offsetHeight -
		new Number(bodyTableCell.style.paddingTop.replace(/[^\d]/g, "")) -
		new Number(bodyTableCell.style.paddingBottom.replace(/[^\d]/g, "")) -
		bodyFooter.offsetHeight - buttonRow.offsetHeight - 2;
	var cachedCorrectHeight;
	if("undefined" != typeof(browseris))
	{
		if(browseris.safari)
		{
			if("undefined" != typeof(cachedCorrectHeight))
			{
				newHeight = cachedCorrectHeight;
			}
			else
			{
				newHeight = newHeight - 75;
				cachedCorrectHeight = newHeight;
			}
		}
	}
	if( newHeight > ConstMinBodyMainHeight)
	{
		bodyMain.style.height = newHeight;
	}
	else
	{
		bodyMain.style.height = ConstMinBodyMainHeight + "px";
	}
	var newWidth = document.body.clientWidth - new Number(bodyTableCell.style.paddingRight.replace(/[^\d]/g, "")) -
		new Number(bodyTableCell.style.paddingLeft.replace(/[^\d]/g, "")) - 2;
	if( newWidth > ConstMinBodyMainWidth)
	{
		bodyMain.style.width = newWidth;
	}
	else
	{
		bodyMain.style.width = ConstMinBodyMainWidth + "px";
	}
}
function onLoad()
{
	try
	{
		if (parent)
		{
			parent.document.title = document.title;
		}
		setSize();
		loaded=true;
	}
	catch (e)
	{
	}
	onResize();
}
</script>
<script>
var loaded=false;
</script>
<body class="ms-dialogBody" onload="javascript:_spBodyOnLoadWrapper(); onLoad();" onkeypress="checkForEsc(event);" onresize="onResize()">
<form runat="server" id="DialogForm" method="post" onsubmit="return _spFormOnSubmitWrapper();">
<table cellpadding=0 cellspacing=0 border=0 width="100%" id="mainTable">
<!-- Dialog Heading Section Begins -->
<asp:ContentPlaceHolder id="PlaceHolderDialogHeaderSection" runat="server">
	<tr id="headingRow" class="" style="">
		<td width="100%" height="0%" style="">
			<table class="ms-dialogHeader" cellspacing=0 cellpadding=0 border=0 width="100%" style="padding-top: 8px; padding-bottom: 10px;" >
				<tr class="">
					<td width=0 valign="middle" align="center" style="padding-left: 15px; padding-right: 15px;">
						<asp:ContentPlaceHolder id="PlaceHolderDialogImage" runat="server">
							<img ID=onetidtpweb1 src="/_layouts/images/detail.gif" alt="">
						</asp:ContentPlaceHolder>
					</td>
					<td class="ms-dialogHeaderDescription" width="100%" valign="top">
						<asp:ContentPlaceHolder id="PlaceHolderDialogDescription" runat="server" />
					</td>
					<td class="ms-dialogHelpLink" width=0 align="right" valign="top" style="padding-right: 10px;" nowrap>
						<asp:ContentPlaceHolder id="PlaceHolderHelpLink" runat="server">
							<a href=javascript:HelpWindowKey("<% = this.HelpKey %>")><SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,multipages_helplink_text%>" EncodeMethod='HtmlEncode'/></a>
						</asp:ContentPlaceHolder >
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td id="headingDivider">
			<div class="ms-dialogHeadingDivider1" height=1><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></div>
			<div class="ms-dialogHeadingDivider2" height=1><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></div>
			<div class="ms-dialogHeadingDivider3" height=1><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></div>
		 </td>
	</tr>
</asp:ContentPlaceHolder>
<!-- Dialog Heading Section Ends -->
<!-- Dialog Body Section Begins -->
<asp:ContentPlaceHolder id="PlaceHolderDialogBodySection" runat="server">
	<tr id="bodyRow" height="100%" style="">
		<td id="bodyTableCell" width="100%" valign="top" style="padding-left: 7px; padding-right: 7px; padding-top: 7px; padding-bottom: 7px;" >
			<table cellspacing=0 cellpadding=0 border=0 width="100%" height="100%" style="">
				<tr>
					<td id="bodyHeader" height=0><asp:ContentPlaceHolder id="PlaceHolderDialogBodyHeaderSection" runat="server"/></td>
				</tr>
				<tr>
					<td width="100%" height="100%" class="ms-dialogBodyMain" valign="top">
						<div id="bodyMain" >
							<asp:ContentPlaceHolder id="PlaceHolderDialogBodyMainSection" runat="server"/>
						</div>
					</td>
				</tr>
				<tr>
					<td id="bodyFooter" height=0><asp:ContentPlaceHolder id="PlaceHolderDialogBodyFooterMainSection" runat="server"/></td>
				</tr>
			</table>
		</td>
	</tr>
</asp:ContentPlaceHolder>
<!-- Dialog Body Section Ends -->
<!-- Dialog Button Section Begins -->
	<tr id="buttonRow">
		<td width="100%" height="0%" class="ms-dialogButtonSection" style="">
			<table id='Buttons' cellspacing=0 cellpadding=0 width=100% border=0>
				<tr height=10><td colspan=3></td></tr>
				<tr >
					<td width=100% colspan=3>
						<asp:ContentPlaceHolder id="PlaceHolderDialogPrebuttonSection" runat="server"/>
					</td>
				</tr>
				<tr>
					<td width="100%">&nbsp;</td>
					<td class="ms-dialogButtonCell" style="padding-right:15px">
						<asp:Button UseSubmitBehavior="false" runat="server" class="ms-ButtonHeightWidth" OnClick="OkButton_Click" Text="<%$Resources:wss,multipages_okbutton_text%>" id="OkButton" accesskey="<%$Resources:wss,okbutton_accesskey%>"/>
					</td>
					<td class="ms-dialogButtonCell" style="padding-right:10px">
						<input type="button" id="CancelButton" class="ms-ButtonHeightWidth" value="<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,multipages_cancelbutton_text%>' EncodeMethod='HtmlEncode'/>" onClick="doCancel();" accesskey="<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,cancelbutton_accesskey%>' EncodeMethod='HtmlEncode'/>"/>
					</td>
					<td class="ms-dialogButtonCell" style="padding-right:10px">
						<asp:ContentPlaceHolder id="PlaceHolderAdditionalButton" runat="server"/>
					</td>
				</tr>
				<tr height=10><td colspan=3></td></tr>
			</table>
		</td>
	</tr>
<!-- Dialog Button Section Ends -->
</table>
</form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions