<?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/"
	>

<channel>
	<title>Ian's Blog</title>
	<atom:link href="http://blog.ianchivers.com/wordpress/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.ianchivers.com/wordpress</link>
	<description></description>
	<lastBuildDate>Sun, 04 Jul 2010 09:38:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Working with Excel Spreadsheets</title>
		<link>http://blog.ianchivers.com/wordpress/?p=55</link>
		<comments>http://blog.ianchivers.com/wordpress/?p=55#comments</comments>
		<pubDate>Sun, 04 Jul 2010 09:38:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.ianchivers.com/wordpress/?p=55</guid>
		<description><![CDATA[Everytime I see some code that has to work with data in Excel files it always uses OLE automation. The worst case of this is on servers to process uploaded files, Microsoft doesn&#8217;t support Office on backend servers. I think a much better method is to use the OLEDB JET database providers, whether it&#8217;s for [...]]]></description>
			<content:encoded><![CDATA[<p>Everytime I see some code that has to work with data in Excel files it always uses OLE automation. The worst case of this is on servers to process uploaded files, Microsoft doesn&#8217;t support Office on backend servers. I think a much better method is to use the OLEDB JET database providers, whether it&#8217;s for Domino, ASP, ASP.NET or anything else for that matter. There&#8217;s no need to install Office at all, if your using Windows 2008 Server 64 bit you will need to install a download from Microsoft to get the ADODB dlls. This method is supported in all versions of Excel including 2007, but this uses the ACE Provider instead of JET.</p>
<p>Anyway, here&#8217;s some code written in LotusScript to demonstrate Create, Read and Update of Excel data. Unfortunately Delete is not supported.</p>
<p>The following code is used to read a XLS file.  It will only read the first Worksheet, but you could read through all of them.</p>
<pre name="code" class="vb">

On Error Goto processError

	Const filename = &quot;c:\users\ian\my documents\writexls.xls&quot;
	Const adSchemaTables = 20

	Dim adodbConnection As Variant
	Dim connectionString As String
	Dim adodbRecordSet As Variant
	Dim worksheet As String

	connectionString = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; &amp;amp; _
	filename &amp;amp; &quot;;Extended Properties=&quot;&quot;Excel 8.0;HDR=Yes;&quot;&quot;&quot;

	Set adodbConnection = CreateObject(&quot;adodb.connection&quot;)
	adodbConnection.Open(connectionString)	

	Set adodbRecordSet = adodbConnection.OpenSchema(adSchemaTables)
	worksheet = adodbRecordSet.Fields(&quot;table_name&quot;).Value

	adodbRecordSet.Close
	adodbRecordSet.Open &quot;SELECT * FROM &quot; + worksheet, adodbConnection
	While Not adodbRecordSet.EOF
		For i = 0 To (adodbRecordSet.Fields.Count - 1)
			Msgbox adodbRecordSet.Fields(i).Value
		Next
		adodbRecordSet.MoveNext
	Wend

	adodbRecordSet.Close
	adodbConnection.Close

finally:

	Set adodbConnection = Nothing
	Set adodbCommand = Nothing
	Exit Sub

processError:

	Print &quot;Error: &quot; &amp;amp; Error &amp;amp; &quot;: &quot; + Error$ + &quot; on line &quot; &amp;amp; Erl
	Goto finally
</pre>
<p>Now, here&#8217;s the code to create, insert and update data in the file:</p>
<pre name="code" class="vb">

On Error Goto processError

	Const filename = &quot;c:\users\ian\my documents\writexls.xls&quot;

	Dim adodbConnection As Variant
	Dim connectionString As String
	Dim adodbCommand As Variant

	Kill filename

	connectionString = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; &amp;amp; _
	filename &amp;amp; &quot;;Extended Properties=&quot;&quot;Excel 8.0;HDR=Yes;&quot;&quot;&quot;

	Set adodbConnection = CreateObject(&quot;adodb.connection&quot;)
	adodbConnection.Open(connectionString)	

	Set adodbCommand = CreateObject(&quot;adodb.command&quot;)
	Set adodbCommand.ActiveConnection = adodbConnection

	adodbCommand.CommandText = &quot;CREATE TABLE [Contacts] ([Id] number, [Name] string)&quot;
	adodbCommand.Execute

	adodbCommand.CommandText = &quot;INSERT INTO [Contacts] ([Id], [Name]) VALUES ('1', 'Ian')&quot;
	adodbCommand.Execute
	adodbCommand.CommandText = &quot;INSERT INTO [Contacts] ([Id], [Name]) VALUES ('2', 'Tom')&quot;
	adodbCommand.Execute

	adodbCommand.CommandText = &quot;UPDATE [Contacts] SET [Name] = 'Paul' WHERE [Id] = 1&quot;
	adodbCommand.Execute

	adodbConnection.Close

finally:

	Set adodbConnection = Nothing
	Set adodbCommand = Nothing
	Exit Sub

processError:

	Print &quot;Error: &quot; &amp;amp; Error &amp;amp; &quot;: &quot; + Error$ + &quot; on line &quot; &amp;amp; Erl
	Goto finally
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianchivers.com/wordpress/?feed=rss2&amp;p=55</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Domino: Read a file attachment without detaching</title>
		<link>http://blog.ianchivers.com/wordpress/?p=47</link>
		<comments>http://blog.ianchivers.com/wordpress/?p=47#comments</comments>
		<pubDate>Wed, 27 Jan 2010 10:09:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Lotus Domino]]></category>

		<guid isPermaLink="false">http://blog.ianchivers.com/wordpress/?p=47</guid>
		<description><![CDATA[The function below shows how you can read a file attachment, in this case a text or csv file into a string without detaching it to disk. Function getAttachmentData Dim doc As NotesDocument Dim stream As NotesStream Dim export As NotesDXLExporter Dim mime As NotesMimeEntity Dim txt As String Dim Start As Double Dim Finish [...]]]></description>
			<content:encoded><![CDATA[<p>The function below shows how you can read a file attachment, in this case a text or csv file into a string without detaching it to disk.</p>
<pre name="code" class="vb">

Function getAttachmentData

	Dim doc As NotesDocument
	Dim stream As NotesStream
	Dim export As NotesDXLExporter
	Dim mime As NotesMimeEntity
	Dim txt As String
	Dim Start As Double
	Dim Finish As Double
	Dim fileData As String

	On Error Goto processError

	If Not dataDictView Is Nothing  Then Set doc = dataDictView.getDocumentByKey(|ARCHIVE CSV FILE| , True ) 

	If Not doc Is Nothing Then
		Set stream = session.CreateStream
		Set export = session.CreateDXLExporter
		'Convert the document to DXL
		export.setInput doc
		export.setOutput stream
		export.process
		'Process the export into a string file (as long as its less than 2GB)
		txt=stream.ReadText
		txt = Replace(txt, Chr(10), ||)
		'Find the &lt;filedata&gt; tags and read what's between them
		Start=Instr(1,txt,|&lt;filedata&gt;|)
		Finish=Instr(1,txt,|&lt;/filedata&gt;|)
		fileData=Mid(txt,Start +10, Finish-Start-11)

		'Truncate the stream and write the filedata into it
		stream.Truncate
		stream.WriteText fileData

		'Setup a NotesMIMEEntity to decode the Base64 string
		Set mime = doc.CreateMIMEEntity(|MIMEEntity|)
		mime.SetContentFromText stream, |text/plain;charset=UTF-8|, ENC_BASE64
		mime.DecodeContent
		getAttachmentData = mime.ContentAsText
	End If

	Exit Function

processError:

	currentlog.LogError Err, |Error: | &amp;amp; Err &amp;amp; |: | &amp;amp; Error &amp;amp; | on line | &amp;amp; Erl &amp;amp; | in Agent: getAttachmentData|
	Exit Function

End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianchivers.com/wordpress/?feed=rss2&amp;p=47</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send a Calendar Invitation from c# using vCalendar</title>
		<link>http://blog.ianchivers.com/wordpress/?p=43</link>
		<comments>http://blog.ianchivers.com/wordpress/?p=43#comments</comments>
		<pubDate>Thu, 11 Jun 2009 09:04:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.ianchivers.com/wordpress/?p=43</guid>
		<description><![CDATA[using System; using System.Collections.Generic; using System.Text; using System.Net.Mail; using System.IO; namespace CalendaringScheduling { class Program { static void Main(string[] args) { StringBuilder sbCalendar = new StringBuilder(); DateTime dtStart = DateTime.Now; DateTime dtEnd = DateTime.Now.AddHours(2); sbCalendar.AppendLine(&#34;METHOD: REQUEST&#34;); sbCalendar.AppendLine(&#34;BEGIN:VCALENDAR&#34;); sbCalendar.AppendLine(&#34;PRODID:-//Ian Chivers//NET&#34;); sbCalendar.AppendLine(&#34;MIMEDIR//ENVERSION:1.0&#34;); sbCalendar.AppendLine(&#34;METHOD:REQUEST&#34;); sbCalendar.AppendLine(&#34;BEGIN:VEVENT&#34;); sbCalendar.AppendLine(&#34;DTSTAMP:&#34; + dtStart.ToUniversalTime().ToString(&#34;yyyyMMdd\\THHmmss\\Z&#34;)); sbCalendar.AppendLine(&#34;DTSTART:&#34; + dtStart.ToUniversalTime().ToString(&#34;yyyyMMdd\\THHmmss\\Z&#34;)); sbCalendar.AppendLine(&#34;DTEND:&#34; + dtEnd.ToUniversalTime().ToString(&#34;yyyyMMdd\\THHmmss\\Z&#34;)); sbCalendar.AppendLine(&#34;LOCATION:Minstead&#34;); sbCalendar.AppendLine(&#34;DESCRIPTION;ENCODING=QUOTED-PRINTABLE:My first meeting&#34;); [...]]]></description>
			<content:encoded><![CDATA[<pre name="code" class="csharp">

using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Mail;
using System.IO;

namespace CalendaringScheduling
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sbCalendar = new StringBuilder();
            DateTime dtStart = DateTime.Now;
            DateTime dtEnd = DateTime.Now.AddHours(2);

            sbCalendar.AppendLine(&quot;METHOD: REQUEST&quot;);
            sbCalendar.AppendLine(&quot;BEGIN:VCALENDAR&quot;);
            sbCalendar.AppendLine(&quot;PRODID:-//Ian Chivers//NET&quot;);
            sbCalendar.AppendLine(&quot;MIMEDIR//ENVERSION:1.0&quot;);
            sbCalendar.AppendLine(&quot;METHOD:REQUEST&quot;);
            sbCalendar.AppendLine(&quot;BEGIN:VEVENT&quot;);
            sbCalendar.AppendLine(&quot;DTSTAMP:&quot; + dtStart.ToUniversalTime().ToString(&quot;yyyyMMdd\\THHmmss\\Z&quot;));
            sbCalendar.AppendLine(&quot;DTSTART:&quot; + dtStart.ToUniversalTime().ToString(&quot;yyyyMMdd\\THHmmss\\Z&quot;));
            sbCalendar.AppendLine(&quot;DTEND:&quot; + dtEnd.ToUniversalTime().ToString(&quot;yyyyMMdd\\THHmmss\\Z&quot;));
            sbCalendar.AppendLine(&quot;LOCATION:Minstead&quot;);
            sbCalendar.AppendLine(&quot;DESCRIPTION;ENCODING=QUOTED-PRINTABLE:My first meeting&quot;);
            sbCalendar.AppendLine(&quot;SUMMARY:Learning Calendaring and Scheduling&quot;);
            sbCalendar.AppendLine(&quot;PRIORITY:3&quot;);
            sbCalendar.AppendLine(&quot;UID:&quot; + Guid.NewGuid().ToString() + &quot;@ianchivers.com&quot;);
            sbCalendar.AppendLine(&quot;ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION:MAILTO:ian.chivers@triangle-group.com&quot;);
            sbCalendar.AppendLine(&quot;ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED:MAILTO:ian@ianchivers.com&quot;);
            sbCalendar.AppendLine(&quot;CLASS:PUBLIC&quot;);
            sbCalendar.AppendLine(&quot;ORGANIZER:MAILTO:ian@ianchivers.com&quot;);
            sbCalendar.AppendLine(&quot;SEQUENCE:0&quot;);
            sbCalendar.AppendLine(&quot;STATUS:TENTATIVE&quot;);
            sbCalendar.AppendLine(&quot;END:VEVENT&quot;);
            sbCalendar.AppendLine(&quot;END:VCALENDAR&quot;);

            byte[] byteArray = Encoding.UTF8.GetBytes(sbCalendar.ToString());

            Stream contentStream = new MemoryStream(byteArray);

            SmtpClient smtp = new SmtpClient(&quot;mx1.hotmail.co.uk&quot;);
            MailMessage memo = new MailMessage(&quot;ian@ianchivers.com&quot;, &quot;ian_chivers@hotmail.co.uk&quot;);
            Attachment attachment = new Attachment(contentStream, &quot;calendar.ics&quot;, &quot;text/calendar&quot;);
            attachment.TransferEncoding = System.Net.Mime.TransferEncoding.Base64;
            memo.Attachments.Add(attachment);
            smtp.Send(memo);

        }
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianchivers.com/wordpress/?feed=rss2&amp;p=43</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Domino Keyword Lookups, jQuery &amp; JSON</title>
		<link>http://blog.ianchivers.com/wordpress/?p=41</link>
		<comments>http://blog.ianchivers.com/wordpress/?p=41#comments</comments>
		<pubDate>Tue, 03 Mar 2009 16:07:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.ianchivers.com/wordpress/?p=41</guid>
		<description><![CDATA[In Domino 8 it became possible to return a view in JSON format using &#38;outputformat=JSON querystring parameter. Here&#8217;s a simple view in Notes: Here is what the JSON looks like: {   &#8220;@timestamp&#8221;: &#8220;20090303T123231,91Z&#8221;,   &#8220;@toplevelentries&#8221;: &#8220;3&#8243;,   &#8220;viewentry&#8221;: [     {       "@position": "1",       "@noteid": "8000000C",     [...]]]></description>
			<content:encoded><![CDATA[<p>In Domino 8 it became possible to return a view in JSON format using &amp;outputformat=JSON querystring parameter.</p>
<p>Here&#8217;s a simple view in Notes:</p>
<p><img src="http://blog.ianchivers.com/wordpress/wp-content/uploads/2009/03/030309-1607-dominokeywo1.png" alt="" /><em><br />
</em><br />
Here is what the JSON looks like:</p>
<p><span style="font-size: 10pt; font-family: Courier New;">{<br />
  &#8220;@timestamp&#8221;: &#8220;20090303T123231,91Z&#8221;,<br />
  &#8220;@toplevelentries&#8221;: &#8220;3&#8243;,<br />
  &#8220;viewentry&#8221;: [<br />
    {<br />
      "@position": "1",<br />
      "@noteid": "8000000C",<br />
      "@children": "4",<br />
      "@descendants": "4",<br />
      "@siblings": "3",<br />
      "entrydata": [<br />
        {<br />
          "@columnnumber": "0",<br />
          "@name": "Index",<br />
          "@category": "true",<br />
          "text": {<br />
            "0": "Option A"<br />
          }<br />
        }<br />
      ]<br />
    },<br />
    {<br />
      &#8220;@position&#8221;: &#8220;1.1&#8243;,<br />
      &#8220;@unid&#8221;: &#8220;84FE562575501BE88025755F0031E1B1&#8243;,<br />
      &#8220;@noteid&#8221;: &#8220;8F6&#8243;,<br />
      &#8220;@siblings&#8221;: &#8220;4&#8243;,<br />
      &#8220;entrydata&#8221;: [<br />
        {<br />
          "@columnnumber": "1",<br />
          "@name": "Choice",<br />
          "textlist": {<br />
            "text": [<br />
              {<br />
                "0": "Choice A1"<br />
              }<br />
            ]<br />
          }<br />
        }<br />
      ]<br />
    },<br />
    {<br />
      &#8220;@position&#8221;: &#8220;1.2&#8243;,<br />
      &#8220;@unid&#8221;: &#8220;84FE562575501BE88025755F0031E1B1&#8243;,<br />
      &#8220;@noteid&#8221;: &#8220;8F6&#8243;,<br />
      &#8220;@siblings&#8221;: &#8220;4&#8243;,<br />
      &#8220;entrydata&#8221;: [<br />
        {<br />
          "@columnnumber": "1",<br />
          "@name": "Choice",<br />
          "textlist": {<br />
            "text": [<br />
              {<br />
                "0": "Choice A2"<br />
              }<br />
            ]<br />
          }<br />
        }<br />
      ]<br />
    },<br />
    {<br />
      &#8220;@position&#8221;: &#8220;1.3&#8243;,<br />
      &#8220;@unid&#8221;: &#8220;84FE562575501BE88025755F0031E1B1&#8243;,<br />
      &#8220;@noteid&#8221;: &#8220;8F6&#8243;,<br />
      &#8220;@siblings&#8221;: &#8220;4&#8243;,<br />
      &#8220;entrydata&#8221;: [<br />
        {<br />
          "@columnnumber": "1",<br />
          "@name": "Choice",<br />
          "textlist": {<br />
            "text": [<br />
              {<br />
                "0": "Choice A3"<br />
              }<br />
            ]<br />
          }<br />
        }<br />
      ]<br />
    },<br />
    {<br />
      &#8220;@position&#8221;: &#8220;1.4&#8243;,<br />
      &#8220;@unid&#8221;: &#8220;84FE562575501BE88025755F0031E1B1&#8243;,<br />
      &#8220;@noteid&#8221;: &#8220;8F6&#8243;,<br />
      &#8220;@siblings&#8221;: &#8220;4&#8243;,<br />
      &#8220;entrydata&#8221;: [<br />
        {<br />
          "@columnnumber": "1",<br />
          "@name": "Choice",<br />
          "textlist": {<br />
            "text": [<br />
              {<br />
                "0": "Choice A4"<br />
              }<br />
            ]<br />
          }<br />
        }<br />
      ]<br />
    },<br />
    {<br />
      &#8220;@position&#8221;: &#8220;2&#8243;,<br />
      &#8220;@noteid&#8221;: &#8220;80000010&#8243;,<br />
      &#8220;@children&#8221;: &#8220;4&#8243;,<br />
      &#8220;@descendants&#8221;: &#8220;4&#8243;,<br />
      &#8220;@siblings&#8221;: &#8220;3&#8243;,<br />
      &#8220;entrydata&#8221;: [<br />
        {<br />
          "@columnnumber": "0",<br />
          "@name": "Index",<br />
          "@category": "true",<br />
          "text": {<br />
            "0": "Option B"<br />
          }<br />
        }<br />
      ]<br />
    },<br />
    {<br />
      &#8220;@position&#8221;: &#8220;2.1&#8243;,<br />
      &#8220;@unid&#8221;: &#8220;866C6FA4AEA492158025755F00328A60&#8243;,<br />
      &#8220;@noteid&#8221;: &#8220;8FA&#8221;,<br />
      &#8220;@siblings&#8221;: &#8220;4&#8243;,<br />
      &#8220;entrydata&#8221;: [<br />
        {<br />
          "@columnnumber": "1",<br />
          "@name": "Choice",<br />
          "textlist": {<br />
            "text": [<br />
              {<br />
                "0": "Choice B1"<br />
              }<br />
            ]<br />
          }<br />
        }<br />
      ]<br />
    },<br />
    {<br />
      &#8220;@position&#8221;: &#8220;2.2&#8243;,<br />
      &#8220;@unid&#8221;: &#8220;866C6FA4AEA492158025755F00328A60&#8243;,<br />
      &#8220;@noteid&#8221;: &#8220;8FA&#8221;,<br />
      &#8220;@siblings&#8221;: &#8220;4&#8243;,<br />
      &#8220;entrydata&#8221;: [<br />
        {<br />
          "@columnnumber": "1",<br />
          "@name": "Choice",<br />
          "textlist": {<br />
            "text": [<br />
              {<br />
                "0": "Choice B2"<br />
              }<br />
            ]<br />
          }<br />
        }<br />
      ]<br />
    },<br />
    {<br />
      &#8220;@position&#8221;: &#8220;2.3&#8243;,<br />
      &#8220;@unid&#8221;: &#8220;866C6FA4AEA492158025755F00328A60&#8243;,<br />
      &#8220;@noteid&#8221;: &#8220;8FA&#8221;,<br />
      &#8220;@siblings&#8221;: &#8220;4&#8243;,<br />
      &#8220;entrydata&#8221;: [<br />
        {<br />
          "@columnnumber": "1",<br />
          "@name": "Choice",<br />
          "textlist": {<br />
            "text": [<br />
              {<br />
                "0": "Choice B3"<br />
              }<br />
            ]<br />
          }<br />
        }<br />
      ]<br />
    },<br />
    {<br />
      &#8220;@position&#8221;: &#8220;2.4&#8243;,<br />
      &#8220;@unid&#8221;: &#8220;866C6FA4AEA492158025755F00328A60&#8243;,<br />
      &#8220;@noteid&#8221;: &#8220;8FA&#8221;,<br />
      &#8220;@siblings&#8221;: &#8220;4&#8243;,<br />
      &#8220;entrydata&#8221;: [<br />
        {<br />
          "@columnnumber": "1",<br />
          "@name": "Choice",<br />
          "textlist": {<br />
            "text": [<br />
              {<br />
                "0": "Choice B4"<br />
              }<br />
            ]<br />
          }<br />
        }<br />
      ]<br />
    },<br />
    {<br />
      &#8220;@position&#8221;: &#8220;3&#8243;,<br />
      &#8220;@noteid&#8221;: &#8220;80000014&#8243;,<br />
      &#8220;@children&#8221;: &#8220;1&#8243;,<br />
      &#8220;@descendants&#8221;: &#8220;1&#8243;,<br />
      &#8220;@siblings&#8221;: &#8220;3&#8243;,<br />
      &#8220;entrydata&#8221;: [<br />
        {<br />
          "@columnnumber": "0",<br />
          "@name": "Index",<br />
          "@category": "true",<br />
          "text": {<br />
            "0": "Option C"<br />
          }<br />
        }<br />
      ]<br />
    },<br />
    {<br />
      &#8220;@position&#8221;: &#8220;3.1&#8243;,<br />
      &#8220;@unid&#8221;: &#8220;B6C86E0C587E08CB802575620031CA0F&#8221;,<br />
      &#8220;@noteid&#8221;: &#8220;8FE&#8221;,<br />
      &#8220;@siblings&#8221;: &#8220;1&#8243;,<br />
      &#8220;entrydata&#8221;: [<br />
        {<br />
          "@columnnumber": "1",<br />
          "@name": "Choice",<br />
          "text": {<br />
            "0": "Choice C1"<br />
          }<br />
        }<br />
      ]<br />
    }<br />
  ]<br />
}<br />
</span><br />
Using jQuery and its incumbent JSON AJAX methods we can return data from the view and process it.</p>
<p>Below is a simple form which has 2 select option drop downs on it:</p>
<p><img src="http://blog.ianchivers.com/wordpress/wp-content/uploads/2009/03/030309-1607-dominokeywo2.png" alt="" /></p>
<p>When the User chooses an Option from the &#8216;Option&#8217; drop down, a set of choices specific to the selected option need to be offered in the &#8216;Choice&#8217; field.</p>
<p>Here is the code from the JSHeader</p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">function Option_changed()<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">{    <br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">    //URL to the view with the restricttocategory set to the selected choice<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">    var url = dbpath + &#8216;/keywords?readviewentries&amp;outputformat=json&amp;restricttocategory=&#8217; + $(&#8216;#Option option:selected&#8217;).text()<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">    //Select object<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">    select = $(&#8216;#Choice&#8217;)                    <br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">    //Default option<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">    options = &#8216;&lt;option value=&#8221;"&gt;&#8211; Please select &#8211;&lt;/option&gt;&#8217;<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">    //jQuery AJAX call to return JSON<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">    $.getJSON(url,function(data) {    <br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">        //Check if we have any rows<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">        if(data.viewentry){<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">            //Loop through the rows<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">            $.each(data.viewentry, function(i, item){        <br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                $.each(item.entrydata, function(i, item){<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                    //If the column contains multi-value<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                    if(item.textlist){<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                        //Loop through the multi-value column data                    <br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                        $.each(item.textlist, function(i, item){<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                            //Loop through the text values<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                            $.each(item, function(i, item){    <br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                                options += &#8216;&lt;option&gt;&#8217; + item[0] + &#8216;&lt;/option&gt;&#8217;<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                            })                        <br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                        })                        <br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                    } else {<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                        //No multi-value so just grab the text<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                        $.each(item.text, function(i, item){<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                            options += &#8216;&lt;option&gt;&#8217; + item + &#8216;&lt;/option&gt;&#8217;<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                        })<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                    }<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">                })<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">            })<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">            //Loop through the columns<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">            select.html(options)<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">        }<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">    })<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">    //<br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">    $(&#8216;#Choice&#8217;).html(options)        <br />
</span></p>
<p><span style="font-size: 9pt; font-family: Arial Narrow;">}<br />
</span><br />
You can download a copy of the Demo database <a title="Download demo" href="http://blog.ianchivers.com/wordpress/wp-content/uploads/2009/03/jQueryJSON.zip" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianchivers.com/wordpress/?feed=rss2&amp;p=41</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Run a SQL Server Agent Job from a Windows Powershell script</title>
		<link>http://blog.ianchivers.com/wordpress/?p=38</link>
		<comments>http://blog.ianchivers.com/wordpress/?p=38#comments</comments>
		<pubDate>Thu, 11 Dec 2008 09:30:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Agent Job]]></category>

		<guid isPermaLink="false">http://blog.ianchivers.com/wordpress/?p=38</guid>
		<description><![CDATA[## ================================================================== ## Title            : runSQLServerAgentJob ## Description  : Start a SQL Server Agent Job ## Author         : Ian Chivers ## Date            : 8/12/2008 ## Input           : -serverInstance &#60;server\instance&#62; -jobName &#60;jobName&#62; ## Usage          : PS&#62; .\runSQLServerAgentJob -serverInstance MyServer -jobName MyJob ## Tag             : SQL Server, SMO, SQL Agent Jobs ## Change log  : ## [...]]]></description>
			<content:encoded><![CDATA[<p><code>## ==================================================================<br />
## Title            : runSQLServerAgentJob<br />
## Description   : Start a SQL Server Agent Job<br />
## Author         : Ian Chivers<br />
## Date            : 8/12/2008<br />
## Input           : -serverInstance &lt;server\instance&gt; -jobName &lt;jobName&gt;<br />
## Usage          : PS&gt; .\runSQLServerAgentJob -serverInstance MyServer -jobName MyJob<br />
## Tag             : SQL Server, SMO, SQL Agent Jobs ## Change log  :<br />
## ==================================================================   </p>
<p>param (<br />
  [string]$serverInstance="(local)",<br />
  [string]$jobName<br />
)</p>
<p>function main() {  <br />
  runSQLServerAgentJob $serverInstance $jobName<br />
}</p>
<p>function runSQLServerAgentJob($ServerInstance, $JobName) {<br />
  trap [Exception]  {<br />
    write-error $("TRAPPED: " + $_.Exception.Message);   continue;  <br />
  } </p>
<p>  #Load SMO assemblies  <br />
  [void][reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo")  <br />
  [void][reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoEnum")  <br />
  [void][reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") <br />
  $namedInstance = new-object('Microsoft.SqlServer.Management.Smo.server')<br />
  ($serverInstance) $namedInstance.jobserver.jobs[$JobName].start()  <br />
}</p>
<p>main <br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianchivers.com/wordpress/?feed=rss2&amp;p=38</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Sharepoint UserGroup Web Service with InfoPath Forms Service</title>
		<link>http://blog.ianchivers.com/wordpress/?p=37</link>
		<comments>http://blog.ianchivers.com/wordpress/?p=37#comments</comments>
		<pubDate>Tue, 09 Sep 2008 12:51:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.ianchivers.com/wordpress/?p=37</guid>
		<description><![CDATA[When you create a data connection to the UserGroup Sharepoint Web Service and select the GetUserCollectionFromGroup method, Infopath doesn&#8217;t interpret the results correctly and you can&#8217;t use the data connection in a Drop Down List control. I&#8217;ve seen examples which use code to get around this problem, but I&#8217;m using the Forms Service so code [...]]]></description>
			<content:encoded><![CDATA[<p>When you create a data connection to the UserGroup Sharepoint Web Service and select the GetUserCollectionFromGroup method, Infopath doesn&#8217;t interpret the results correctly and you can&#8217;t use the data connection in a Drop Down List control. I&#8217;ve seen examples which use code to get around this problem, but I&#8217;m using the Forms Service so code is not an option. We need to modify Infopath&#8217;s xsd file of the web service data connection to fix the problem.</p>
<p>In the example below I will create a data connection to the <a href="http://moss/_vti_bin/usergroup.asmx">http://moss/_vti_bin/usergroup.asmx</a> web service to receive data to use in a Drop Down List to pick from the members of a Sharepoint Group.</p>
<ol>
<li>Create the Data Connection</li>
</ol>
<p><img src="http://blog.ianchivers.com/wordpress/wp-content/uploads/2008/09/090908-1248-usingsharep1.jpg" alt="" /></p>
<p style="margin-left: 18pt">2. Select Web Service</p>
<p><img src="http://blog.ianchivers.com/wordpress/wp-content/uploads/2008/09/090908-1248-usingsharep2.jpg" alt="" /></p>
<p style="margin-left: 18pt">3. Enter the URL to the UserGroup web service, don&#8217;t forget to include your site in the URL if appropriate.</p>
<p><img src="http://blog.ianchivers.com/wordpress/wp-content/uploads/2008/09/090908-1248-usingsharep3.jpg" alt="" /></p>
<p style="margin-left: 18pt">4. For this example I&#8217;m using the GetUserCollectionFromGroup method</p>
<p><img src="http://blog.ianchivers.com/wordpress/wp-content/uploads/2008/09/090908-1248-usingsharep4.jpg" alt="" /></p>
<p style="margin-left: 18pt">5. Provide InfoPath with an <strong>example</strong> Group Name</p>
<p style="margin-left: 18pt">6. Provide InfoPath with the <strong>actual</strong> Group Name you want this Data Connection to query</p>
<p style="margin-left: 18pt">7. Choose if you want to store a copy of the data in the form template for use in Offline mode. Since I&#8217;m using the Forms Service the form will never be used offline, so I&#8217;m leaving the box unchecked</p>
<p style="margin-left: 18pt">8. Give your new Data Connection a name and Finish the wizard</p>
<p><img src="http://blog.ianchivers.com/wordpress/wp-content/uploads/2008/09/090908-1248-usingsharep7.jpg" alt="" /></p>
<p>Next we need to save the Form so we can manually edit the XSD for the Data Connection. From the File drop down manu choose <em>Save as Source Files…</em></p>
<p>Open the folder where you saved the Form and you should see a Developers1.xsd file, edit this file with your favourite XML Editor (or notepad). Update the file so it looks like the snippet below, I&#8217;ve put in a comment at the start and end of the modification.</p>
<pre name="code" class="xml">

&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;s:schema elementFormDefault=&quot;qualified&quot; targetNamespace=&quot;http://schemas.microsoft.com/sharepoint/soap/directory/&quot; xmlns:s=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:wsdl=&quot;http://schemas.xmlsoap.org/wsdl/&quot; xmlns:soap=&quot;http://schemas.xmlsoap.org/wsdl/soap/&quot; xmlns:tm=&quot;http://microsoft.com/wsdl/mime/textMatching/&quot; xmlns:soapenc=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:mime=&quot;http://schemas.xmlsoap.org/wsdl/mime/&quot; xmlns:tns=&quot;http://schemas.microsoft.com/sharepoint/soap/directory/&quot; xmlns:soap12=&quot;http://schemas.xmlsoap.org/wsdl/soap12/&quot; xmlns:http=&quot;http://schemas.xmlsoap.org/wsdl/http/&quot;&gt;
	&lt;s:import namespace=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;&lt;/s:import&gt;
	&lt;!-- Beginning of insert --&gt;
	&lt;s:complexType name=&quot;GetUserCollectionFromGroupType&quot;&gt;
		&lt;s:sequence&gt;
			&lt;s:element minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot; name=&quot;Users&quot;&gt;
				&lt;s:complexType&gt;
					&lt;s:sequence&gt;
						&lt;s:element maxOccurs=&quot;unbounded&quot; name=&quot;User&quot; &gt;
							&lt;s:complexType&gt;
								&lt;s:attribute name=&quot;Notes&quot; type=&quot;s:string&quot;&gt;&lt;/s:attribute&gt;
								&lt;s:attribute name=&quot;Name&quot; type=&quot;s:string&quot;&gt;&lt;/s:attribute&gt;
								&lt;s:attribute name=&quot;IsSiteAdmin&quot; type=&quot;s:string&quot;&gt;&lt;/s:attribute&gt;
								&lt;s:attribute name=&quot;Sid&quot; type=&quot;s:string&quot;&gt;&lt;/s:attribute&gt;
								&lt;s:attribute name=&quot;ID&quot; type=&quot;s:string&quot;&gt;&lt;/s:attribute&gt;
								&lt;s:attribute name=&quot;LoginName&quot; type=&quot;s:string&quot;&gt;&lt;/s:attribute&gt;
								&lt;s:attribute name=&quot;Email&quot; type=&quot;s:string&quot;&gt;&lt;/s:attribute&gt;
								&lt;s:attribute name=&quot;IsDomainGroup&quot; type=&quot;s:string&quot;&gt;&lt;/s:attribute&gt;
							&lt;/s:complexType&gt;
						&lt;/s:element&gt;
					&lt;/s:sequence&gt;
				&lt;/s:complexType&gt;
			&lt;/s:element&gt;
		&lt;/s:sequence&gt;
	&lt;/s:complexType&gt;
	&lt;!-- End of Insert --&gt;
	&lt;s:element name=&quot;GetUserCollectionFromSite&quot;&gt;
		&lt;s:complexType&gt;&lt;/s:complexType&gt;
	&lt;/s:element&gt;
</pre>
<p>We need to change another part of this file, replacing a s:element block.</p>
<pre name="code" class="xml">

&lt;!--&lt;s:element name=&quot;GetUserCollectionFromGroup&quot;&gt;
  &lt;s:complexType&gt;
    &lt;s:sequence&gt;
      &lt;s:element minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot; name=&quot;groupName&quot; type=&quot;s:string&quot;&gt;&lt;/s:element&gt;
    &lt;/s:sequence&gt;
  &lt;/s:complexType&gt;
&lt;/s:element&gt;--&gt;
&lt;!-- Beginning of insert --&gt;
&lt;s:element name=&quot;GetUserCollectionFromGroup&quot; type=&quot;tns:GetUserCollectionFromGroupType&quot; /&gt;
&lt;!-- End of insert --&gt;
</pre>
<p>Now save the Developers1.xsd file, right click on the Manifest.xsf file and choose Design.</p>
<p>Add a Drop Down List Control and set its Data Source to Developers, you should now be able to select the correct attributes returned from the web service.</p>
<p>You can Save the Form as a standard XSN file, but DO NOT edit the Developers Data Source in InfoPath or you will overwrite the changes made to the Developers1.xsd file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianchivers.com/wordpress/?feed=rss2&amp;p=37</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Sharepoint Drop Down Context Menu Workflow Shortcut</title>
		<link>http://blog.ianchivers.com/wordpress/?p=30</link>
		<comments>http://blog.ianchivers.com/wordpress/?p=30#comments</comments>
		<pubDate>Thu, 12 Jun 2008 07:43:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ichivers.110mb.com/wordpress/?p=30</guid>
		<description><![CDATA[It&#8217;s fairly simple to add custom menu options to the drop down context menu in sharepoint library/list views.  One useful example maybe to provide a shortcut to start workflows, instead of opening the workflow page; selecting the desired workflow and clicking the Start button. To do this we need to add some Javascript to the page.  [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s fairly simple to add custom menu options to the drop down context menu in sharepoint library/list views.  One useful example maybe to provide a shortcut to start workflows, instead of opening the workflow page; selecting the desired workflow and clicking the Start button.</p>
<p>To do this we need to add some Javascript to the page.  Edit the page and add a Content Editor Web Part, hide it by clearing its Layout / Visible on Page checkbox.  Edit the Content Editor Web Part Source and insert the following Javascript:</p>
<pre name="code" class="javascript">

&lt;script language=&quot;javascript&quot;&gt;

function Custom_AddDocLibMenuItems(m, ctx)
{
var strDisplayText = &quot;Send for Review&quot;;
var strAction = &quot;http://sharepointserver/Workflows/Send%20for%20Review/Send%20for%20Review.aspx?List=14987b66-90be-4693-aafd-94bc6ba8f18e&amp;amp;amp;ID=24&amp;amp;amp;TemplateID={dcbbce95-46dc-4b58-b69e-a99b9ea6a698}&amp;amp;amp;Source=http%3A%2F%2Fsharepoint%2Edomain%2Ecom%2FWIP%2FForms%2FOpen%2Easpx%3FPageView%3DShared&quot;;

var strImagePath = &quot;&quot;;

var start = strAction.indexOf(&quot;&amp;amp;amp;ID=&quot;)+4
var prefix = strAction.substr(0, start)
var suffix = strAction.substr(strAction.indexOf(&quot;&amp;amp;amp;&quot;, start), strAction.length)

strAction = &quot;location.href = '&quot; + prefix + currentItemID + suffix + &quot;'&quot;

// Add our new menu item
CAMOpt(m, strDisplayText, strAction, strImagePath);

// add a separator to the menu
CAMSep(m);

return false;
}
&lt;/script&gt;
</pre>
<p>If you update the workflow you will need to edit the strAction property as the URL will change. Also if you try to start a workflow using the shortcut on an item where the workflow is already running the workflow will error. If there is a way to check if workflow is running on an item I&#8217;d be interested to know how it&#8217;s done!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianchivers.com/wordpress/?feed=rss2&amp;p=30</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Microsoft SQL Server Data Services</title>
		<link>http://blog.ianchivers.com/wordpress/?p=29</link>
		<comments>http://blog.ianchivers.com/wordpress/?p=29#comments</comments>
		<pubDate>Wed, 04 Jun 2008 08:05:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ichivers.110mb.com/wordpress/?p=29</guid>
		<description><![CDATA[Microsoft‟s Data Platform vision meets the needs of the evolving data explosion and the next generation of data-driven web applications with its new services offering in the cloud called Microsoft® SQL Server™ Data Services (SSDS). SQL Server Data Services (SSDS) is a highly scalable web facing data storage and query processing utility. Built on robust [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft‟s Data Platform vision meets the needs of the evolving data explosion and the next generation of data-driven web applications with its new services offering in the cloud called Microsoft® SQL Server™ Data Services (SSDS). SQL Server Data Services (SSDS) is a highly scalable web facing data storage and query processing utility. </p>
<p>Built on robust SQL Server database technology, these services provide high availability and security and support standards-based web protocols and interfaces (SOAP, REST) for rapid provisioning and ease of programming. </p>
<p>Businesses can store and access all types of data from birth to archival, using Microsoft SQL Server Data Services. Users can access information on any device, from the desktop to a mobile device. </p>
<p>Read on to learn how SQL Server Data Services deliver on the Microsoft Data Platform vision and meets the needs of the next generation of data-driven applications.</p>
<p><a href="http://www.microsoft.com/sql/dataservices/default.mspx">http://www.microsoft.com/sql/dataservices/default.mspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianchivers.com/wordpress/?feed=rss2&amp;p=29</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VBScript Active Directory LDAP ANR Query</title>
		<link>http://blog.ianchivers.com/wordpress/?p=24</link>
		<comments>http://blog.ianchivers.com/wordpress/?p=24#comments</comments>
		<pubDate>Tue, 03 Jun 2008 07:45:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ichivers.110mb.com/wordpress/?p=24</guid>
		<description><![CDATA[Here&#8217;s a really simple Active Directory ANR (Ambiguous Name Resolution) query that uses VBScript and ADO.  name = &#34;ian&#34; Set objDomain = GetObject (&#34;LDAP://rootDSE&#34;) Set conn = CreateObject(&#34;ADODB.Connection&#34;) conn.provider =&#34;ADsDSOObject&#34; conn.open &#34;Active Directory Provider&#34; Set Comm = CreateObject(&#34;ADODB.Command&#34;) Set Comm.ActiveConnection = conn Comm.CommandText = &#34;&#60;LDAP://&#34; &#38; objDomain.get(&#34;defaultnamingcontext&#34;) &#38; &#34;&#62;;(&#38;(objectCategory=User)(anr=&#34; + name + &#34;));displayName,AdsPath;subtree&#34; Set rs [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a really simple Active Directory ANR (Ambiguous Name Resolution) query that uses VBScript and ADO. </p>
<pre name="code" class="vb">

name = &quot;ian&quot;

Set objDomain = GetObject (&quot;LDAP://rootDSE&quot;)
Set conn = CreateObject(&quot;ADODB.Connection&quot;)
conn.provider =&quot;ADsDSOObject&quot;
conn.open &quot;Active Directory Provider&quot;
Set Comm = CreateObject(&quot;ADODB.Command&quot;)
Set Comm.ActiveConnection = conn
Comm.CommandText = &quot;&lt;LDAP://&quot; &amp; objDomain.get(&quot;defaultnamingcontext&quot;) &amp; &quot;&gt;;(&amp;(objectCategory=User)(anr=&quot; + name + &quot;));displayName,AdsPath;subtree&quot;

Set rs = Comm.Execute
Set objUser = GetObject(rs.Fields(&quot;ADsPath&quot;).Value)

msgbox objUser.Get(&quot;mail&quot;)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianchivers.com/wordpress/?feed=rss2&amp;p=24</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lotus Notes DXL to remove Design Element Inherit from the design template</title>
		<link>http://blog.ianchivers.com/wordpress/?p=25</link>
		<comments>http://blog.ianchivers.com/wordpress/?p=25#comments</comments>
		<pubDate>Tue, 03 Jun 2008 07:35:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://ichivers.110mb.com/wordpress/?p=25</guid>
		<description><![CDATA[There is no easy way in Domino Designer Client to clear the &#8220;Inherit from the design template&#8221; design element property from all design elements.  The best you can do is to view all the forms, highlight those that show as inheriting from a design template as clear the property.  But you have repeat this for Forms, [...]]]></description>
			<content:encoded><![CDATA[<p>There is no easy way in Domino Designer Client to clear the &#8220;Inherit from the design template&#8221; design element property from all design elements.  The best you can do is to view all the forms, highlight those that show as inheriting from a design template as clear the property.  But you have repeat this for Forms, Views, Agents, Script Libraries, etc.</p>
<p>When copying and pasting design elements from one database to another, if the source database is defined as a template then the following dialog box will appear:</p>
<p><img class="aligncenter" title="inheritdesign2" src="http://ichivers.110mb.com/wordpress/wp-content/uploads/2008/06/inheritdesign2.jpg" alt="" width="691" height="126" /></p>
<p>If you answer yes to this prompt then the design element will be set to inherit from the source database.</p>
<p>To clear the property from all design elements use the following Agent code, which uses DXL to export, update and overwrite the design element.</p>
<pre name="code" class="vb">

Sub Initialize

Dim session As New NotesSession
Dim db As NotesDatabase
Dim note As NotesDocument
Dim noteCollection As NotesNoteCollection
Dim stream As NotesStream
Dim domParser As NotesDOMParser
Dim exporter As NotesDXLExporter
Dim importer As NotesDXLImporter
Dim attrib As NotesDOMAttributeNode
Dim nid As String
Dim found As Boolean
Dim i As Integer

Set db = session.CurrentDatabase

'Get a note collection of all the design elements
Set noteCollection = db.CreateNoteCollection(False)
noteCollection.SelectAllFormatElements False
noteCollection.SelectAllDesignElements True
noteCollection.BuildCollection

'Loop through the note collection
nid = noteCollection.GetFirstNoteId
For i = 1 To noteCollection.Count
Set note = db.GetDocumentByID(nid)

'Create a stream to store the DXL export output
Set stream = session.CreateStream
Set exporter = session.CreateDXLExporter
'Create a DOMParser to manage the DXL
Set domParser = session.CreateDOMParser(exporter, stream)
'Export the design element to the DOMParser
exporter.SetInput note
exporter.SetOutput domParser
exporter.Process

'Get the fromtemplate attribute from the exported XML
Set attrib = domParser.Document.DocumentElement.GetAttributeNode(&quot;fromtemplate&quot;)

'If the fromtemplate attribute exists and is not blank we need to blank it and import the DXL
If attrib.isNull = False Then
If attrib.AttributeValue &lt;&gt; &quot;&quot; Then
attrib.AttributeValue = &quot;&quot;
'Serialize the DXL so the importer has data to work with
domParser.Serialize
Set importer = session.CreateDXLimporter(stream, db)
importer.DesignImportOption = DXLIMPORTOPTION_REPLACE_ELSE_CREATE
importer.Import
End If
End If

nid = noteCollection.GetNextNoteId(nid)
Next

End Sub
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianchivers.com/wordpress/?feed=rss2&amp;p=25</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
