<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Integration Points</title>
	<atom:link href="http://dmgorman.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dmgorman.wordpress.com</link>
	<description>Extending Corporate Data ...</description>
	<lastBuildDate>Wed, 25 Nov 2009 19:16:38 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='dmgorman.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/09ff9c9336e6ecd7cc49045a62d1aab3?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Integration Points</title>
		<link>http://dmgorman.wordpress.com</link>
	</image>
			<item>
		<title>#32 Our Expense Notices</title>
		<link>http://dmgorman.wordpress.com/2009/11/25/32-our-expense-notices/</link>
		<comments>http://dmgorman.wordpress.com/2009/11/25/32-our-expense-notices/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 13:03:05 +0000</pubDate>
		<dc:creator>dmgorman</dc:creator>
				<category><![CDATA[Deltek]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://dmgorman.wordpress.com/?p=347</guid>
		<description><![CDATA[We send out simple email notices from information in Deltek&#8217;s database.
If you have the Enterprise Edition of SQL Server you can do this straight-up using Data Driven Subscriptions which is a really nice feature of SQL Reporting that allows you to use a query to determine who gets the report via email and what is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=347&subd=dmgorman&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>We send out simple email notices from information in Deltek&#8217;s database.</p>
<p>If you have the Enterprise Edition of SQL Server you can do this straight-up using Data Driven Subscriptions which is a really nice feature of SQL Reporting that allows you to use a query to determine who gets the report via email and what is in the report for each one sent.  Here is a link  to get you started: <a title="Data Driven SQL Reports Subscriptions" href="http://msdn.microsoft.com/en-us/library/ms169673.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ms169673.aspx</a><br />
<em><br />
But since we do not have that license and option I am using code to to the two queries &#8211; (1) the target email address &amp; (2) the report details &#8211; namely their expense report.<br />
</em><br />
This is the extraction Stored Procedure:</p>
<pre class="brush: sql;">
Procedure [dbo].[BWSP_getExpenseReceipts]
as
Select      EM.email
,               EM.Employee
,               EX.EmployeeName
,               EX.Amount
,               EX.CheckNo
,               EX.CheckDate
,               EX.ReportName
,               EX.ReportDate
from EM
Join exChecks EX on ( EM.Employee = EX.Employee )
</pre>
<p>On our intranet we have a grid that displays the pending check receipt data &amp; a simple process button to approve. This page is secure to accounting personnel.</p>
<p>The process uses SMTP and data from the Stored Procedure above to form an individual email for each involved employee.</p>
<pre class="brush: csharp;">
 private void sendNotifications()
    {

        string sTitle = &quot;Expense Check Notification&quot;;
        string sMsg = &quot;&quot;;
        string sSourceEmail = @&quot;***@***&quot;;
        DataSet ds = DeltekUtilities.getPendingExpenseNotifications(); // ADO call to get data using the SP above
        DataTableReader  dr = ds.CreateDataReader();
        int ii = 0;
        while (dr.Read())
        {
            ii++;
            sMsg = &quot;===================================================================================&quot; + &quot;\n&quot;;
            sMsg += &quot;                    Expense Check Notification   &quot; + &quot;\n&quot;;
            sMsg += &quot;===================================================================================&quot; + &quot;\n\n&quot;;
            //sMsg += &quot;               Email: &quot; + dr[&quot;email&quot;].ToString() + &quot;\n&quot;;
            sMsg += &quot;            Employee: &quot; + dr[&quot;EmployeeName&quot;].ToString() + &quot;\n&quot;;
            sMsg += &quot;      Deposit Amount: &quot; + String.Format(&quot;{0:c}&quot;, Double.Parse(dr[&quot;Amount&quot;].ToString())) + &quot;\n&quot;;
            sMsg += &quot;        Deposit Date: &quot; + String.Format(&quot;{0:d}&quot;, dr[&quot;CheckDate&quot;]) + &quot;\n&quot;;
            sMsg += &quot;         Description: &quot; + dr[&quot;ReportName&quot;].ToString() + &quot;\n&quot;;
            sMsg += &quot;---------------------------------------------------------------------------------&quot;;

            try
            {
                Utilities.sendEmail(sSourceEmail, dr[&quot;email&quot;].ToString().Trim(), string.Empty, sTitle, sMsg, false);
            }
            catch (Exception ex)
            {
                lblMessage.Text += &quot;&lt;br&gt; error sending: &quot; +  dr[&quot;email&quot;].ToString();
            }
        }
        if (dr != null)
        {
            dr.Close();
            dr.Dispose();
        }

        lblMessage.Text += &quot;&lt;br&gt;&quot; +  ii.ToString() + &quot; Emails Sent&quot;;

    }

// Send Email Utility Call

public static bool sendEmail(string sSourceEmail, string sTargetEmailList, string sCCEmailList, string sMsgTitle, string sMsg,  bool isHTMLemail)
    {

        bool bReturn    = false;
        SmtpClient client = new SmtpClient();
        client.Host = &quot;****&quot;;
        MailMessage mm = new MailMessage();
        try
        {
            mm.Sender       = new MailAddress(sSourceEmail);
            mm.From         = new MailAddress(sSourceEmail);
            mm.To.Add (new MailAddress(sTargetEmailList));
            if (sCCEmailList.Length &gt; 0)
                mm.CC.Add (new MailAddress(sCCEmailList));
            mm.Subject      = sMsgTitle;
            mm.Body         = sMsg;
            mm.IsBodyHtml   = isHTMLemail;

            client.Send(mm);
            bReturn = true;
        }
        catch (Exception ex)
        {
            string sEmails = &quot; Email List [&quot; + sSourceEmail + &quot; &quot; + sTargetEmailList + &quot; &quot; + sCCEmailList + &quot;] &quot;;
            throw new IntranetException(ex.Message + sEmails,
                                              ex,
                                              SystemConstants.Intranet_ErrorMessage);

        }

        return bReturn;
    }
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmgorman.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmgorman.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmgorman.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmgorman.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmgorman.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmgorman.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmgorman.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmgorman.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmgorman.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmgorman.wordpress.com/347/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=347&subd=dmgorman&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dmgorman.wordpress.com/2009/11/25/32-our-expense-notices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0f40e4ba23d8f519bc9491fe6ae71f78?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmgorman</media:title>
		</media:content>
	</item>
		<item>
		<title>#31 Linq Parsing &#8211; checking for missing XElement</title>
		<link>http://dmgorman.wordpress.com/2009/08/26/31-linq-parsing-checking-for-missing-xelement/</link>
		<comments>http://dmgorman.wordpress.com/2009/08/26/31-linq-parsing-checking-for-missing-xelement/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 18:51:33 +0000</pubDate>
		<dc:creator>dmgorman</dc:creator>
				<category><![CDATA[Linq]]></category>

		<guid isPermaLink="false">http://dmgorman.wordpress.com/?p=337</guid>
		<description><![CDATA[I am loading an object fed from an XML document that expects a string for each element whether it exists or not. Since some elements are optional this bit of code helps return an empty string instead of getting a null exception. The method loadElement below checks for null and returns string.empty instead.
See http://www.switchonthecode.com/tutorials/introduction-to-linq-simple-xml-parsing for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=337&subd=dmgorman&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I am loading an object fed from an XML document that expects a string for each element whether it exists or not. Since some elements are optional this bit of code helps return an empty string instead of getting a null exception. The method loadElement below checks for null and returns string.empty instead.</p>
<p>See <a href="http://www.switchonthecode.com/tutorials/introduction-to-linq-simple-xml-parsing" target="_blank">http://www.switchonthecode.com/tutorials/introduction-to-linq-simple-xml-parsing</a><span style="color:#000000;"> </span>for parsing code</p>
<pre class="brush: csharp;">

private List&lt;SampleObject&gt; readParse( string FilePath)
{

XDocument xmlDoc = XDocument.Load(FilePath);

List&lt; SampleObject &gt; ObjectList  =
(from RANGEVARNAME in xmlDoc.Descendants(&quot;PARENTNODE&quot;)
select new SampleObject
{

item1     =  loadElement(RANGEVARNAME.Element(&quot;item1&quot;)),
item2     =  loadElement(RANGEVARNAME.Element(&quot;item2&quot;)),
. . .
}).ToList&lt;SampleObject&gt;();

lblMessage.Text = &quot;Loading &quot; + FilePath + &quot; (&quot; + ObjectList.Count + &quot;) Records&quot;;

return (ObjectList);

}

 private string loadElement(XElement E)
{
  return((E==null)? string.Empty: E.Value);
} 
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmgorman.wordpress.com/337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmgorman.wordpress.com/337/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmgorman.wordpress.com/337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmgorman.wordpress.com/337/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmgorman.wordpress.com/337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmgorman.wordpress.com/337/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmgorman.wordpress.com/337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmgorman.wordpress.com/337/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmgorman.wordpress.com/337/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmgorman.wordpress.com/337/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=337&subd=dmgorman&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dmgorman.wordpress.com/2009/08/26/31-linq-parsing-checking-for-missing-xelement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0f40e4ba23d8f519bc9491fe6ae71f78?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmgorman</media:title>
		</media:content>
	</item>
		<item>
		<title>#30 Sharepoint: Accessing a Site Collection\SPWeb within a Workflow and updating a list</title>
		<link>http://dmgorman.wordpress.com/2009/07/20/30-sharepoint-accessing-a-site-collection-within-a-workflow-and-updating-a-list/</link>
		<comments>http://dmgorman.wordpress.com/2009/07/20/30-sharepoint-accessing-a-site-collection-within-a-workflow-and-updating-a-list/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 21:38:56 +0000</pubDate>
		<dc:creator>dmgorman</dc:creator>
				<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://dmgorman.wordpress.com/?p=310</guid>
		<description><![CDATA[Below I am grabbing data off a Workflow with a browser enabled Infopath Form and loading a separate list.


public Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties workflowProperties = new Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties(); 

  private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
        {

              ...
  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=310&subd=dmgorman&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Below I am grabbing data off a Workflow with a browser enabled Infopath Form and loading a separate list.</p>
<pre class="brush: csharp;">

public Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties workflowProperties = new Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties(); 

  private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
        {

              ...
                //Save the identifier for the workflow
                workflowId = workflowProperties.WorkflowId;

                // InitiationData comes from the initialization form
                XmlDocument document = new XmlDocument();
                document.LoadXml(workflowProperties.InitiationData);

                // Get Data Off Of Init Form
                XmlNamespaceManager ns = new XmlNamespaceManager(document.NameTable);
                ns.AddNamespace(&quot;my&quot;, &quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-05T20:04:17&quot;);
                managerUsername = document.SelectSingleNode(&quot;/my:flowFields/my:managerUsername&quot;, ns).InnerText;
                managerFullname = document.SelectSingleNode(&quot;/my:flowFields/my:managerFullname&quot;, ns).InnerText;
                reviewType = document.SelectSingleNode(&quot;/my:flowFields/my:reviewType&quot;, ns).InnerText;
                reviewComments = document.SelectSingleNode(&quot;/my:flowFields/my:reviewComments&quot;, ns).InnerText; 

                using (SPSite siteCollection = workflowProperties.Site)
                {
                    using (SPWeb web = siteCollection.OpenWeb())
                    {
                        SPList EmployeeReviewList = (SPList)web.Lists[&quot;EmployeeReview&quot;];                     // Specific List
                        SPListItem EmployeeReviewItem = OptimizedAddItem(EmployeeReviewList);       // Add New Item to List
                        EmployeeReviewItem[&quot;Review Name&quot;] = reviewType;                                            // Update elements of new item
                        EmployeeReviewItem.Update();
                    }
                }  

  ... }

       //cf.  http://blog.robgarrett.com/2009/02/25/efficient-way-to-add-a-new-item-to-a-sharepoint-list
        public  SPListItem OptimizedAddItem(SPList list)
        {
            const string EmptyQuery = &quot;0&quot;;
            SPQuery q = new SPQuery { Query = EmptyQuery };
            return list.GetItems(q).Add();
        }
</pre>
<p>Credit due for OptimizedAddItem():  <a href="http://blog.robgarrett.com/2009/02/25/efficient-way-to-add-a-new-item-to-a-sharepoint-list/" target="_blank">http://blog.robgarrett.com/2009/02/25/efficient-way-to-add-a-new-item-to-a-sharepoint-list/</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmgorman.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmgorman.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmgorman.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmgorman.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmgorman.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmgorman.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmgorman.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmgorman.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmgorman.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmgorman.wordpress.com/310/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=310&subd=dmgorman&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dmgorman.wordpress.com/2009/07/20/30-sharepoint-accessing-a-site-collection-within-a-workflow-and-updating-a-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0f40e4ba23d8f519bc9491fe6ae71f78?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmgorman</media:title>
		</media:content>
	</item>
		<item>
		<title>#29 PopUp under Deltek 6.x Smart Client</title>
		<link>http://dmgorman.wordpress.com/2009/07/15/29-popup-under-deltek-6-x-smart-client/</link>
		<comments>http://dmgorman.wordpress.com/2009/07/15/29-popup-under-deltek-6-x-smart-client/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 16:46:08 +0000</pubDate>
		<dc:creator>dmgorman</dc:creator>
				<category><![CDATA[Deltek]]></category>
		<category><![CDATA[hacks]]></category>

		<guid isPermaLink="false">http://dmgorman.wordpress.com/?p=303</guid>
		<description><![CDATA[The issue is that by running a smart client an iframe or window open launches a browser window separate from the smart client which is a Windows client executable &#38; not a browser app. Since that is unavoidable using a modal window with target self tag in the head works best.  This method will [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=303&subd=dmgorman&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The issue is that by running a smart client an iframe or window open launches a browser window separate from the smart client which is a Windows client executable &amp; not a browser app. Since that is unavoidable using a modal window with target self tag in the head works best.  This method will however still leave the initial help window open in the smart client. </p>
<p>Add the Help Icon ? and replace the Help Text (directly via a control-V paste do not click on ellipse to launch editor) with:</p>
<pre class="brush: jscript;">
&lt;script&gt;javascript:  window.showModalDialog(&quot;http://targetpage.aspx&quot;,'_parent', &quot;dialogHeight: 200px;&quot;);&lt;/script&gt;
</pre>
<p>In your target page (html or aspx) since this is a modal window this will &#8216;correct&#8217; any postbacks from launching a new window. </p>
<pre class="brush: xml;">
&lt;HTML&gt;
                &lt;HEAD&gt;
                                &lt;base target=&quot;_self&quot; /&gt;
 ...
</pre>
<p>Put a button with a OnClick event to close this popup. The <em> window.opener=&#8217;X';window.open(&#8221;,&#8217;_parent&#8217;,&#8221;);window.close();</em>  will avoid the usual warning. </p>
<p>Credit Due on avoiding the window close warning: <a href="http://blogs.x2line.com/al/articles/350.aspx">http://blogs.x2line.com/al/articles/350.aspx<br />
</a></p>
<pre class="brush: jscript;">
					function CopyToClipboard()
					{
						document.frmVisible.txtJobNumber.focus();
						document.frmVisible.txtJobNumber.select();
						CopiedTxt = document.selection.createRange();
						CopiedTxt.execCommand(&quot;Copy&quot;);
						alert('Number has been copied. Use Control-V to paste into new project screen.');
						window.opener='X';window.open('','_parent','');window.close();
					}
</pre>
<p>cf . <a href="http://dmgorman.wordpress.com/2008/01/11/02-simple-popup-help-page/">http://dmgorman.wordpress.com/2008/01/11/02-simple-popup-help-page/ </a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmgorman.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmgorman.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmgorman.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmgorman.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmgorman.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmgorman.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmgorman.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmgorman.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmgorman.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmgorman.wordpress.com/303/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=303&subd=dmgorman&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dmgorman.wordpress.com/2009/07/15/29-popup-under-deltek-6-x-smart-client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0f40e4ba23d8f519bc9491fe6ae71f78?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmgorman</media:title>
		</media:content>
	</item>
		<item>
		<title>#28 Deltek operator (agent) ID &amp; email via Workflow</title>
		<link>http://dmgorman.wordpress.com/2009/06/26/28-deltek-user-id-via-workflow/</link>
		<comments>http://dmgorman.wordpress.com/2009/06/26/28-deltek-user-id-via-workflow/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 02:39:23 +0000</pubDate>
		<dc:creator>dmgorman</dc:creator>
				<category><![CDATA[Deltek]]></category>
		<category><![CDATA[hacks]]></category>

		<guid isPermaLink="false">http://dmgorman.wordpress.com/?p=276</guid>
		<description><![CDATA[If you need to get the agent processing the workflow you can call the UDF GetVisionAuditUsername()

You can then wrap this UDF call in a SP to get something like an Email address from the EM table for email processing to the operator/agent which is something missing from Deltek&#8217;s WF options.  Sending the person doing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=276&subd=dmgorman&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you need to get the agent processing the workflow you can call the UDF <strong>GetVisionAuditUsername()<br />
</strong></p>
<p>You can then wrap this UDF call in a SP to get something like an Email address from the EM table for email processing to the operator/agent which is something missing from Deltek&#8217;s WF options.  Sending the person doing the operation (agent) an email has been missing in Deltek WF  (you can send their manager an email but not the person doing the work).  At least this is what we see in 5.1 and since 6.0 is same/same we probably have the same issue there &#8211; though I have not checked there. If anyone sees otherwise please post a comment. Thanks!</p>
<p><em><br />
** Note: This will require the context provided by Deltek&#8217;s WF since the UDF uses &#8216;context_info&#8217; from master.dbo.sysprocesses **</em></p>
<pre class="brush: sql;">
Create Procedure getAgentEmail()
AS
BEGIN
	Declare @Employee as varchar(20)

	Select @Employee = [dbo].[GetVisionAuditUsername]()

	Select EM.Email
        From EM
        Where EM.Employee = Substring(@Employee,1,3)
            -- substring if needed to get proper key

         -- It would be wise to parm these values in!
         EXEC msdb..sp_send_dbmail
            @profile_name='ProfileName'
           , @recipients= @Email
           , @subject='Test message'
           , @body='This is the body of the test message'

END
</pre>
<p><strong>SQL 2008 Mail Setup</strong><br />
<a target='_blank' href="http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/">http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/  </a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmgorman.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmgorman.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmgorman.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmgorman.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmgorman.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmgorman.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmgorman.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmgorman.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmgorman.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmgorman.wordpress.com/276/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=276&subd=dmgorman&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dmgorman.wordpress.com/2009/06/26/28-deltek-user-id-via-workflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0f40e4ba23d8f519bc9491fe6ae71f78?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmgorman</media:title>
		</media:content>
	</item>
		<item>
		<title>#27 Simple Ajax WebPart Setup</title>
		<link>http://dmgorman.wordpress.com/2009/06/03/27-simple-first-ajax-webpart-setup/</link>
		<comments>http://dmgorman.wordpress.com/2009/06/03/27-simple-first-ajax-webpart-setup/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 15:17:01 +0000</pubDate>
		<dc:creator>dmgorman</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://dmgorman.wordpress.com/?p=238</guid>
		<description><![CDATA[This post is liberally linked into other very good resources &#8211; I only offer it as a help or path through some of the options. The &#8216;lazy&#8217; web.config reconfigure via Visual Studio framework switch is very effective. I did it manually on a test system and had a lot of control reference problems. I will [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=238&subd=dmgorman&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>This post is liberally linked into other very good resources &#8211; I only offer it as a help or path through some of the options. </strong><em>The &#8216;lazy&#8217; web.config reconfigure via Visual Studio framework switch is very effective. I did it manually on a test system and had a lot of control reference problems. I will be trying it again to better understand what I missed though this time with a web.config to run a diff against. </em></p>
<p>Install Net Framework 3.5 SP1</p>
<p><span style="text-decoration:underline;"><strong>Web.Config Setup</strong></span><em><br />
</em></p>
<ol>
<li>Backup site web.config</li>
<li>Create a 2.0 web app in VS</li>
<li>Copy in web.config</li>
<li>Change target framework to 3.5 and save web.config over production.</li>
<li>Reference: <a href="http://weblogs.asp.net/jan/archive/2008/10/10/enabling-net-3-5-in-sharepoint-2007-sites-the-lazy-way.aspx">http://weblogs.asp.net/jan/archive/2008/10/10/enabling-net-3-5-in-sharepoint-2007-sites-the-lazy-way.aspx</a></li>
</ol>
<p>Add safe control in &lt;Sharepoint&gt;&lt;SafeControls&gt; make sure it is 3.5.0.0 (if 3.5 SP1 installed)</p>
<ol>
<li>Reference: <a href="http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3">http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3  (see Point 6 ) </a></li>
<li>Reference: <a href="http://www.codeproject.com/KB/sharepoint/MossAjaxWebPart.aspx?display=PrintAll&amp;fid=417786&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;select=2156594">http://www.codeproject.com/KB/sharepoint/MossAjaxWebPart.aspx?display=PrintAll&amp;fid=417786&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;select=2156594</a></li>
</ol>
<p><span style="text-decoration:underline;"><strong>Default.Master</strong></span></p>
<ol>
<li> Add SPScriptManager to (default) master page via SPD (Sharepoint Designer)  &#8211; here is where to place it.</li>
</ol>
<pre class="brush: xml;">

 &lt;form runat=”server”&gt;

&lt;WebPartPages:SPWebPartManager runat=”Server” /&gt;

&lt;asp:ScriptManager runat=”server” ID=”ScriptManager1″&gt;

&lt;/asp:ScriptManager&gt;

&lt;TABLE class=”ms-main” CELLPADDING=0 CELLSPACING=0 BORDER=0

WIDTH=”100%” HEIGHT=”100%”&gt;
</pre>
<p><em> SPD designer gives a IE 6 warning ??<strong> ignore it</strong></em></p>
<p><strong><span style="text-decoration:underline;">Ajax Web Part</span></strong><em><strong><br />
</strong></em></p>
<ol>
<li>Deploy a simple Ajax Web Part</li>
<li>Reference: <a href="http://jamestsai.net/Blog/post/How-To-Create-AJAX-enabled-SharePoint-Web-Part-with-UpdatePanel-and-UpdateProgress-in-10-minutes.aspx">http://jamestsai.net/Blog/post/How-To-Create-AJAX-enabled-SharePoint-Web-Part-with-UpdatePanel-and-UpdateProgress-in-10-minutes.aspx</a></li>
</ol>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmgorman.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmgorman.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmgorman.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmgorman.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmgorman.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmgorman.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmgorman.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmgorman.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmgorman.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmgorman.wordpress.com/238/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=238&subd=dmgorman&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dmgorman.wordpress.com/2009/06/03/27-simple-first-ajax-webpart-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0f40e4ba23d8f519bc9491fe6ae71f78?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmgorman</media:title>
		</media:content>
	</item>
		<item>
		<title>#26 Remove Offending WebPart causing a sever error</title>
		<link>http://dmgorman.wordpress.com/2009/06/02/26-remove-offending-webpart-that-causing-a-sever-error/</link>
		<comments>http://dmgorman.wordpress.com/2009/06/02/26-remove-offending-webpart-that-causing-a-sever-error/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 18:24:17 +0000</pubDate>
		<dc:creator>dmgorman</dc:creator>
				<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://dmgorman.wordpress.com/?p=224</guid>
		<description><![CDATA[Occasionally I have &#8216;friends&#8217; that hammer a page and have a hard time getting back to Kansas.   Recently, I (ahem) my friend added a Ajax WP forgetting to add the ScriptManager to the master page which causes a parse error and you cannot get back into the page via SPD or other means (easily).   You [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=224&subd=dmgorman&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Occasionally I have &#8216;friends&#8217; that hammer a page and have a hard time getting back to Kansas.   Recently, I (ahem) <em>my friend</em> added a Ajax WP forgetting to add the ScriptManager to the master page which causes a parse error and you cannot get back into the page via SPD or other means (easily).   You often get a SPD view error jamming you up :</p>
<p><span style="color:#888888;">soap:ServerServer was unable to process request. &#8212;&gt; A Web Part or Web Form Control on this Web Part Page cannot be displayed or imported because it is not registered as safe on this site. You may not be able to open this page in an HTML editor that is compatible with Microsoft Windows SharePoint Services, such as Microsoft Office SharePoint Designer. To fix this page, contact the site administrator to have the Web Part or Web Form Control configured as safe. You can also remove the Web Part or Web Form Control from the page by using the Web Parts Maintenance Page. If you have the necessary permissions, you can use this page to disable Web Parts temporarily or remove personal settings. For more information, contact your site administrator.</span></p>
<p>There is a &#8216;trick&#8217; to view web parts on a page and delete the offender. Go to the Brown Screen of Death page and add<span style="color:#99ccff;"><strong> ?contents=1 </strong></span>at the end of the URL.  The browser will display (depending on permissions) a maintence view and the Web Parts that are the page &#8211; where you can delete the offender.</p>
<p>Credit due: <a href="http://www.blogcoward.com/archive/2009/03/29/Sharepoint-Designer-2007-A-Web-Part-or-Web-Form-Control.aspx" target="_blank">http://www.blogcoward.com/archive/2009/03/29/Sharepoint-Designer-2007-A-Web-Part-or-Web-Form-Control.aspx</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmgorman.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmgorman.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmgorman.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmgorman.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmgorman.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmgorman.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmgorman.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmgorman.wordpress.com/224/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmgorman.wordpress.com/224/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmgorman.wordpress.com/224/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=224&subd=dmgorman&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dmgorman.wordpress.com/2009/06/02/26-remove-offending-webpart-that-causing-a-sever-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0f40e4ba23d8f519bc9491fe6ae71f78?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmgorman</media:title>
		</media:content>
	</item>
		<item>
		<title>#25 Birthdays &amp; Service Anniversaries</title>
		<link>http://dmgorman.wordpress.com/2009/05/29/25-birthdays-servic-anniversaries/</link>
		<comments>http://dmgorman.wordpress.com/2009/05/29/25-birthdays-servic-anniversaries/#comments</comments>
		<pubDate>Fri, 29 May 2009 15:55:10 +0000</pubDate>
		<dc:creator>dmgorman</dc:creator>
				<category><![CDATA[Intranet Integration]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://dmgorman.wordpress.com/?p=216</guid>
		<description><![CDATA[Variation on a theme &#8211; here we display weekly birthdays &#38; service anniversaries.
Stored Procedure:


Procedure SP_Weekly
as
Select EM.Employee as EmpNum
, EmployeePhoto
, isNull(EM.PreferredName,EM.FirstName) + ' ' + RTRIM( EM.LastName) as EmployeeName
, RTRIM(datepart(month,custEmp_BirthDate)) + '/' +  RTRIM(datepart(day,custEmp_BirthDate)) as DateField
, 'Birthday'  as Notes
From EmployeeCustomTabFields ECTF
Join EM on (EM.Employee = ECTF.Employee)
Where
datepart(week,custEmp_BirthDate) = datepart(week,getdate())
And Status = 'A'
Union All
Select EM.Employee as EmpNum
, EmployeePhoto
, isNull(EM.PreferredName,EM.FirstName) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=216&subd=dmgorman&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div id="attachment_219" class="wp-caption aligncenter" style="width: 330px"><a rel="attachment wp-att-219" href="http://dmgorman.wordpress.com/2009/05/29/25-birthdays-servic-anniversaries/yos-3/"><img class="size-full wp-image-219" title="Birthdays &amp; Years of Service" src="http://dmgorman.files.wordpress.com/2009/05/yos2.jpg?w=320&#038;h=320" alt="Birthdays &amp; Years of Service" width="320" height="320" /></a><p class="wp-caption-text">Birthdays &amp; Years of Service</p></div>
<p>Variation on a theme &#8211; here we display weekly birthdays &amp; service anniversaries.</p>
<p><strong>Stored Procedure:</strong></p>
<pre class="brush: sql;">

Procedure SP_Weekly
as
Select EM.Employee as EmpNum
, EmployeePhoto
, isNull(EM.PreferredName,EM.FirstName) + ' ' + RTRIM( EM.LastName) as EmployeeName
, RTRIM(datepart(month,custEmp_BirthDate)) + '/' +  RTRIM(datepart(day,custEmp_BirthDate)) as DateField
, 'Birthday'  as Notes
From EmployeeCustomTabFields ECTF
Join EM on (EM.Employee = ECTF.Employee)
Where
datepart(week,custEmp_BirthDate) = datepart(week,getdate())
And Status = 'A'
Union All
Select EM.Employee as EmpNum
, EmployeePhoto
, isNull(EM.PreferredName,EM.FirstName) + ' ' + RTRIM( EM.LastName) as EmployeeName
, RTRIM(datepart(month,HireDate)) + '/' +  RTRIM(datepart(day,HireDate))
  + '/' +  RTRIM(datepart(year,HireDate)) as DateField
, Cast(DateDiff(year, HireDate, getdate()) as varchar(12)) + RTRIM(' Years of Service' )  as Notes
From EmployeeCustomTabFields ECTF
Join EM on (EM.Employee = ECTF.Employee)
Where
datepart(week,HireDate) = datepart(week,getdate())
And Status = 'A'
Order By 4
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmgorman.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmgorman.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmgorman.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmgorman.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmgorman.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmgorman.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmgorman.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmgorman.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmgorman.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmgorman.wordpress.com/216/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=216&subd=dmgorman&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dmgorman.wordpress.com/2009/05/29/25-birthdays-servic-anniversaries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0f40e4ba23d8f519bc9491fe6ae71f78?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmgorman</media:title>
		</media:content>

		<media:content url="http://dmgorman.files.wordpress.com/2009/05/yos2.jpg" medium="image">
			<media:title type="html">Birthdays &#38; Years of Service</media:title>
		</media:content>
	</item>
		<item>
		<title>#24 Small Employee Directory SP Web Part</title>
		<link>http://dmgorman.wordpress.com/2009/05/28/24-small-employee-directory-sp-web-part/</link>
		<comments>http://dmgorman.wordpress.com/2009/05/28/24-small-employee-directory-sp-web-part/#comments</comments>
		<pubDate>Thu, 28 May 2009 21:26:54 +0000</pubDate>
		<dc:creator>dmgorman</dc:creator>
				<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[MOSS]]></category>

		<guid isPermaLink="false">http://dmgorman.wordpress.com/?p=186</guid>
		<description><![CDATA[

  This web part exposes props for an advance search URL, results table width and max record count. The results are displayed via bind to an ASP.Net Repeater.
 Credit Due for dynamic template code
BWEmpDirSmall.cs

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
//add
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Data.Common;
using System.Web.Configuration;
using System.Data.SqlTypes;
using System.Xml.Serialization;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint;
using System.IO;

namespace [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=186&subd=dmgorman&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="mceTemp mceIEcenter">
<div id="attachment_211" class="wp-caption aligncenter" style="width: 310px"><a rel="attachment wp-att-211" href="http://dmgorman.wordpress.com/2009/05/28/24-small-employee-directory-sp-web-part/empdir-6/"><img class="size-full wp-image-211" title="EmpDir" src="http://dmgorman.files.wordpress.com/2009/05/empdir4.jpg?w=300&#038;h=197" alt="Employee Directory for Sharepoint Column" width="300" height="197" /></a><p class="wp-caption-text">Employee Directory for Sharepoint Column</p></div>
</div>
<p> <em> This web part exposes props for an advance search URL, results table width and max record count. The results are displayed via bind to an ASP.Net Repeater.</em></p>
<div id="attachment_208" class="wp-caption aligncenter" style="width: 220px"><a rel="attachment wp-att-208" href="http://dmgorman.wordpress.com/2009/05/28/24-small-employee-directory-sp-web-part/props/"><img class="size-full wp-image-208" title="props" src="http://dmgorman.files.wordpress.com/2009/05/props.jpg?w=210&#038;h=245" alt="properties exposed in Sharepoint" width="210" height="245" /></a><p class="wp-caption-text">properties exposed in Sharepoint</p></div>
<p> <a title="Template Code" href="http://msdn.microsoft.com/en-us/library/y0h809ak(VS.71).aspx" target="_blank">Credit Due for dynamic template code</a></p>
<p><strong>BWEmpDirSmall.cs</strong></p>
<pre class="brush: csharp;">
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
//add
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Data.Common;
using System.Web.Configuration;
using System.Data.SqlTypes;
using System.Xml.Serialization;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint;
using System.IO;

namespace BWEmpDirSmall
{
    [Guid(&quot;60c0ce25-603a-4c24-8d99-8b6046f013fe&quot;)]
    public class BWEmployeeSearch2 : Microsoft.SharePoint.WebPartPages.WebPart
    {
        private bool _error = false;

        private Label lblMessage;
        private TextBox txtSearch;
        private Button btnSearch;
        private Button btnClear;
        private Repeater rptList;
        private HyperLink hlAdvSearch;

        [Personalizable(PersonalizationScope.Shared)]
        [WebBrowsable(true)]
        [System.ComponentModel.Category(&quot;My Property Group&quot;)]
        [WebDisplayName(&quot;Advance Search Page&quot;)]
        [WebDescription(&quot;URL to Advance Search&quot;)]
        public string AdvSearchURL { get; set; }

        [Personalizable(PersonalizationScope.Shared)]
        [WebBrowsable(true)]
        [System.ComponentModel.Category(&quot;My Property Group&quot;)]
        [WebDisplayName(&quot;Table Width&quot;)]
        [WebDescription(&quot;Filter &amp;amp; Results Table Width&quot;)]
        public string TableWidth { get; set; }

        [Personalizable(PersonalizationScope.Shared)]
        [WebBrowsable(true)]
        [System.ComponentModel.Category(&quot;My Property Group&quot;)]
        [WebDisplayName(&quot;Max Count&quot;)]
        [WebDescription(&quot;Maximum Rows Returned&quot;)]
        public string MaxCount { get; set; }
        public BWEmployeeSearch2()
        {
            this.ExportMode = WebPartExportMode.All;
            this.AdvSearchURL = @&quot;&lt;a href='http://portal'&gt;******&lt;/a&gt;&quot;;
            this.TableWidth = &quot;220px&quot;;
            this.MaxCount = &quot;25&quot;;
        }

        /// &lt;summary&gt;
        /// Sets Display
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;writer&quot;&gt;&lt;/param&gt;
        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.Write(&quot;&lt;table width='&quot; + TableWidth + &quot;' border='0' &gt;&quot;);

            spanRow(writer, &quot;left&quot;, &quot;2&quot;);
            //writer.Write(&quot;&lt;b&gt;Search: &lt;/b&gt;&quot;);

            txtSearch.RenderControl(writer);
            writer.Write(&quot;&amp;nbsp;&quot;);
            btnSearch.RenderControl(writer);
            writer.Write(&quot;&amp;nbsp;&quot;);
            btnClear.RenderControl(writer);
            rowEnd(writer);

            spanRow(writer, &quot;left&quot;, &quot;2&quot;);
            hlAdvSearch.RenderControl(writer);
            rowEnd(writer);

            spanRow(writer, &quot;left&quot;, &quot;2&quot;);
            lblMessage.RenderControl(writer);
            rowEnd(writer);

            spanRow(writer, &quot;left&quot;, &quot;2&quot;);
            rptList.RenderControl(writer);
            rowEnd(writer);

            writer.Write(&quot;&lt;/table&gt;&quot;);
        }

        protected void rowStart(HtmlTextWriter writer, string sAlign) { writer.Write(&quot;&lt;tr&gt;&lt;td align=&quot; + sAlign + &quot;&gt;&quot;); }
        protected void cellEnd(HtmlTextWriter writer) { writer.Write(&quot;&lt;/td&gt;&quot;); }
        protected void cellEndStart(HtmlTextWriter writer, string sAlign) { writer.Write(&quot;&lt;/td&gt;&lt;td align=&quot; + sAlign + &quot;&gt;&quot;); }
        protected void rowEnd(HtmlTextWriter writer) { writer.Write(&quot;&lt;/td&gt;&lt;/tr&gt;&quot;); }
        protected void spanRow(HtmlTextWriter writer, string sAlign, string colspan)
        {
            writer.Write(&quot;&lt;tr&gt;&lt;td align=&quot; + sAlign + &quot; colspan=&quot; + colspan + &quot; &gt;&quot;);
        }

        /// &lt;summary&gt;
        /// Create all your controls here for rendering.
        /// Try to avoid using the RenderWebPart() method.
        /// &lt;/summary&gt;
        protected override void CreateChildControls()
        {
            if (!_error)
            {
                try
                {

                    base.CreateChildControls();

                     lblMessage = new Label();
                    btnSearch = new Button();
                    btnClear = new Button();
                    txtSearch = new TextBox();
                    hlAdvSearch = new HyperLink();

                    this.lblMessage.Width = new Unit(&quot;200px&quot;);

                    this.btnSearch.Text = &quot;Search&quot;;
                    this.btnSearch.Click += new EventHandler(btnSubmit_Click);
                    this.btnClear.Text = &quot;Clear&quot;;
                    this.btnClear.Click += new EventHandler(btnClear_Click);

                    this.rptList = new Repeater();
                    this.rptList.ItemTemplate = new MyTemplate(MaxCount);

                    this.hlAdvSearch.Text = &quot;Advance Search&quot;;
                    this.hlAdvSearch.NavigateUrl = AdvSearchURL;

                    this.Controls.Add(lblMessage);
                    this.Controls.Add(txtSearch);
                    this.Controls.Add(rptList);
                    this.Controls.Add(btnSearch);
                    this.Controls.Add(btnClear);
                    this.Controls.Add(hlAdvSearch);

                    this.lblMessage.Width = new Unit(&quot;180px&quot;);
                    this.btnSearch.Width = new Unit(&quot;60px&quot;);
                    this.btnClear.Width = new Unit(&quot;60px&quot;);
                    this.txtSearch.Width = new Unit(&quot;150px&quot;);

                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
            }
        }

        /// &lt;summary&gt;
        /// Ensures that the CreateChildControls() is called before events.
        /// Use CreateChildControls() to create your controls.
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;e&quot;&gt;&lt;/param&gt;
        protected override void OnLoad(EventArgs e)
        {
            if (!_error)
            {
                try
                {
                    base.OnLoad(e);
                    this.EnsureChildControls();

                    // Your code here...
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
            }
        }

        /// &lt;summary&gt;
        /// Clear all child controls and add an error message for display.
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;ex&quot;&gt;&lt;/param&gt;
        private void HandleException(Exception ex)
        {
            this._error = true;
            this.Controls.Clear();
            this.Controls.Add(new LiteralControl(ex.Message));
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {

            this.rptList.ItemTemplate = new MyTemplate(MaxCount);

            if (Utilities.hasData(txtSearch))
                bindRepeater();
            else
            {
                lblMessage.Text = &quot;No Search Criteria Entered&quot;;
                //this.rptList.DataSource = new string[] { }; //clear
                //this.rptList.DataBind();
            }

        }
        protected void btnClear_Click(object sender, EventArgs e)
        {
            txtSearch.Text = string.Empty;
            this.rptList.DataSource = new string[] { }; //clear
            this.rptList.DataBind();
            lblMessage.Text = &quot;&quot;;
        }
        private void bindRepeater()
        {
            DataSet ds = Employee.searchEmployees(txtSearch.Text.Trim());
            this.rptList.DataSource = ds;
            this.rptList.DataBind();
            int iRecCount = 0;
            Int32.TryParse(ds.Tables[0].Rows.Count.ToString(),out iRecCount);
            if (iRecCount &lt; (Int32.Parse(MaxCount)))
                this.lblMessage.Text = iRecCount.ToString() + &quot; record(s) found&quot;;
            else
                this.lblMessage.Text = iRecCount.ToString() + &quot; Recs Exceeded &quot; + MaxCount + &quot; Max&quot;;
        }

    }
}
</pre>
<p><strong>MyTemplate.cs</strong></p>
<pre class="brush: csharp;">
using System;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BWEmpDirSmall
{
    public class MyTemplate : ITemplate
    {

            static int itemcount = 0;
            static int MAXCOUNT = 25;
            ListItemType templateType;

            public MyTemplate()
            {
                templateType = ListItemType.Item;
                itemcount = 0;
            }

            public MyTemplate(string s)
            {
                templateType = ListItemType.Item;
                MAXCOUNT = 25;
                Int32.TryParse(s, out MAXCOUNT);
                itemcount = 0;
            }

            public MyTemplate(ListItemType type)
            {
                templateType = type;
                itemcount = 0;
            }

            public void InstantiateIn(System.Web.UI.Control container)
            {
                Literal lc = new Literal();
                //switch (templateType)
                //{
                //    case ListItemType.Header:
                //        lc.Text = &quot;&lt;TABLE border=1&gt;&lt;TR&gt;&lt;TH&gt;Items&lt;/TH&gt;&lt;/TR&gt;&quot;;
                //        break;
                //    case ListItemType.Item:
                //        //lc.Text = &quot;&lt;TR&gt;&lt;TD&gt;Item number: &quot; + itemcount.ToString() +
                //        //   &quot;&lt;/TD&gt;&lt;/TR&gt;&quot;;
                //          lc.Text = DataBinder.Eval(Container.DataItem, &quot;FirstName&quot;);
                //        break;
                //    case ListItemType.AlternatingItem:
                //        lc.Text = &quot;&lt;TR&gt;&lt;TD bgcolor=lightblue&gt;Item number: &quot; +
                //           itemcount.ToString() + &quot;&lt;/TD&gt;&lt;/TR&gt;&quot;;
                //        break;
                //    case ListItemType.Footer:
                //        lc.Text = &quot;&lt;/TABLE&gt;&quot;;
                //        break;
                //}
                if (itemcount &lt;= MAXCOUNT)
                {
                    lc.DataBinding += new EventHandler(TemplateControl_DataBinding);
                    container.Controls.Add(lc);
                }
                itemcount++;

            }

            private void TemplateControl_DataBinding(object sender, System.EventArgs e)
            {
                Literal lc;
                lc = (Literal)sender;
                RepeaterItem container = (RepeaterItem)lc.NamingContainer;
                lc.Text += &quot;&amp;amp;raquo; &lt;font color='#99000'&gt;&lt;b&gt; &quot;;
                lc.Text += DataBinder.Eval(container.DataItem, &quot;FirstName&quot;);
                lc.Text += &quot; &amp;nbsp;&quot; + DataBinder.Eval(container.DataItem, &quot;LastName&quot;);
                lc.Text += &quot;&lt;/b&gt;&lt;/font&gt; &quot;;
                if (Utilities.hasData(DataBinder.Eval(container.DataItem, &quot;WorkPhoneExt&quot;).ToString()))
                    lc.Text += &quot;&lt;b&gt; x/&quot; + DataBinder.Eval(container.DataItem, &quot;WorkPhoneExt&quot;) + &quot;&lt;/b&gt;&quot;;
                lc.Text += &quot;&lt;br /&gt;&quot;;
                if (Utilities.hasData(DataBinder.Eval(container.DataItem, &quot;WorkPhone&quot;).ToString()))
                    lc.Text += &quot;&amp;nbsp;&lt;i&gt;&quot; + DataBinder.Eval(container.DataItem, &quot;WorkPhone&quot;) + &quot;&lt;/i&gt;&amp;nbsp;&quot;;
                if (Utilities.hasData(DataBinder.Eval(container.DataItem, &quot;MobilePhone&quot;).ToString()))
                    lc.Text += &quot;&lt;i&gt; Cell: &quot; + DataBinder.Eval(container.DataItem, &quot;MobilePhone&quot;) + &quot;&lt;/i&gt; &quot;;
                lc.Text += &quot;&lt;br /&gt; &quot;;
            }
    }

}
</pre>
<p><strong>Employee cs  searchEmployees method:</strong></p>
<pre class="brush: csharp;">
static public DataSet searchEmployees(string sTarget)
    {

        SqlCommand cmd = null;
        SqlDataAdapter da = null;
        DataSet ds = new DataSet(&quot;Employees&quot;);
        using (SqlConnection conn = Utilities.getConnR())
        {

            try
            {
                cmd = new SqlCommand(&quot;searchEmployees&quot;, conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter(&quot;@Target&quot;, SqlDbType.Text));
                cmd.Parameters[&quot;@Target&quot;].Value = sTarget.Trim();

                conn.Open();
                da = new SqlDataAdapter(cmd);
                da.Fill(ds);

            }
            catch (Exception err)
            {
                throw new ApplicationException(err.Message.ToString());

                //err.Message.ToString();
            }
            finally
            {
                if (cmd != null) { cmd.Dispose(); }
                if (da != null) { da.Dispose(); }
            }
        }
        return ds;

    }
</pre>
<p><strong>Stored Procedure:</strong></p>
<pre class="brush: sql;">
Procedure [dbo].[searchEmployees]
(
  @Target  nvarchar(50)
)
as
  Select
   EM.Employee as EmpNum
 , RTRIM(EM.Employee) + '-' +  SUBSTRING(EM.FirstName,1,1)
  +  RTRIM(Case When(DATALENGTH(EM.MiddleName) = 0) Then '' Else  SUBSTRING(EM.MiddleName,1,1) End )
     +  SUBSTRING(EM.LastName,1,1)  as Employee
 , isNull(EM.PreferredName,EM.FirstName)    as FirstName
 , (RTRIM(EM.LastName) + ' ' + isNull(Suffix,''))  as LastName
 , EM.MiddleName
 , EM.Org         as PrimaryDept
 , EM.Region
 , EM.WorkPhone
 , EM.WorkPhoneExt
 , EM.MobilePhone
 , ECTF.Cust5ULPhysical      as Office
 , ECTF.custSecondaryDepartment     as SecondaryDept
  From
    EM
  Join EmployeeCustomTabFields ECTF on ( ECTF.Employee = EM.Employee )
  Where
 EM.Status = 'A'
 And (  EM.FirstName  like  Case When (@Target is null) Then '%' Else RTRIM(@Target) + '%' End
     OR EM.PreferredName   like  Case When (@Target is null) Then '%' Else RTRIM(@Target) + '%' End
     OR EM.LastName   like  Case When (@Target is null) Then '%' Else RTRIM(@Target) + '%' End
   OR    SUBSTRING(EM.FirstName,1,1)  +  RTRIM(Case When(DATALENGTH(EM.MiddleName) = 0) Then '' Else  SUBSTRING(EM.MiddleName,1,1) End )  +  SUBSTRING(EM.LastName,1,1)  like Case When (@Target is null) Then '%' Else  @Target  End
     OR EM.WorkPhone like '%' + isNull(@Target,'%') + '%'
   OR EM.WorkPhoneExt like '%' + isNull(@Target,'%') + '%'
   OR EM.MobilePhone like '%' + isNull(@Target,'%') + '%'
   OR  ECTF.Cust5ULPhysical = isNull(@Target, ECTF.Cust5ULPhysical)
   OR  EM.Employee like  isNull(@Target,'%') + '%'   )
</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmgorman.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmgorman.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmgorman.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmgorman.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmgorman.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmgorman.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmgorman.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmgorman.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmgorman.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmgorman.wordpress.com/186/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=186&subd=dmgorman&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dmgorman.wordpress.com/2009/05/28/24-small-employee-directory-sp-web-part/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0f40e4ba23d8f519bc9491fe6ae71f78?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmgorman</media:title>
		</media:content>

		<media:content url="http://dmgorman.files.wordpress.com/2009/05/empdir4.jpg" medium="image">
			<media:title type="html">EmpDir</media:title>
		</media:content>

		<media:content url="http://dmgorman.files.wordpress.com/2009/05/props.jpg" medium="image">
			<media:title type="html">props</media:title>
		</media:content>
	</item>
		<item>
		<title>#23 Installing Business Data Catalog Definition Editor &#8211; error 2869</title>
		<link>http://dmgorman.wordpress.com/2009/05/12/23-installing-business-data-catalog-definition-editor-error-2869/</link>
		<comments>http://dmgorman.wordpress.com/2009/05/12/23-installing-business-data-catalog-definition-editor-error-2869/#comments</comments>
		<pubDate>Tue, 12 May 2009 19:11:12 +0000</pubDate>
		<dc:creator>dmgorman</dc:creator>
				<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://dmgorman.wordpress.com/?p=175</guid>
		<description><![CDATA[When installing the Business Data Catalog Definition Editor which allows (makes it easy for) you to connect your data sources to the Sharepoint Business Data Catalog you can get this odd error. I was loading in Windows Server 2003 &#38; all the posts I saw were for issues with Vista.  Hope this helps those non-Vista [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=175&subd=dmgorman&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When installing the Business Data Catalog Definition Editor which allows (makes it easy for) you to connect your data sources to the Sharepoint Business Data Catalog you can get this odd error. I was loading in Windows Server 2003 &amp; all the posts I saw were for issues with Vista.  Hope this helps those non-Vista users suffering this issue.</p>
<p><em>My Log entry:<br />
</em></p>
<p><em>Event Type:    Error Event Source:    MsiInstaller Event Category:    None Event ID:    10005 Date:        Time:          PM User:        CSISERVER Description: Product: Microsoft ®  Application Definition Designer &#8212; The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2869. </em></p>
<p>For those that install packages a lot this may be obvious &#8211; use the setup.exe directly instead of the msi package. It will install SQL 2005 Express with the app (there are some unhappy posts on that around) but the Definition Editor installs.</p>
<p>If looking for the SDK here are the links:</p>
<p><a title="Microsoft SharePoint Team Blog" href="http://blogs.msdn.com/sharepoint/archive/2007/08/22/announcing-the-microsoft-business-data-catalog-definition-editor-for-microsoft-office-sharepoint-server-2007.aspx" target="_blank">http://blogs.msdn.com/sharepoint/archive/2007/08/22/announcing-the-microsoft-business-data-catalog-definition-editor-for-microsoft-office-sharepoint-server-2007.aspx </a><br />
<a title="SharePoint Server 2007 SDK: Software Development Kit" href="http://www.microsoft.com/downloads/details.aspx?familyid=6d94e307-67d9-41ac-b2d6-0074d6286fa9&amp;displaylang=en" target="_blank">http://www.microsoft.com/downloads/details.aspx?familyid=6d94e307-67d9-41ac-b2d6-0074d6286fa9&amp;displaylang=en<br />
</a></p>
<p><a title="SharePoint Server 2007 SDK: Software Development Kit" href="http://www.microsoft.com/downloads/details.aspx?familyid=6d94e307-67d9-41ac-b2d6-0074d6286fa9&amp;displaylang=en" target="_blank"><br />
</a></p>
<p><a href="http://blogs.msdn.com/sharepoint/archive/2007/08/22/announcing-the-microsoft-business-data-catalog-definition-editor-for-microsoft-office-sharepoint-server-2007.aspx"><br />
</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dmgorman.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dmgorman.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dmgorman.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dmgorman.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dmgorman.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dmgorman.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dmgorman.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dmgorman.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dmgorman.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dmgorman.wordpress.com/175/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dmgorman.wordpress.com&blog=2497805&post=175&subd=dmgorman&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dmgorman.wordpress.com/2009/05/12/23-installing-business-data-catalog-definition-editor-error-2869/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0f40e4ba23d8f519bc9491fe6ae71f78?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">dmgorman</media:title>
		</media:content>
	</item>
	</channel>
</rss>