Help Creating XmlNode / XmlAttribute Elegantly

I am creating a configuration class to read / write a standard configuration file.

		<?xml version="1.0" encoding="utf-8"?>
		<configuration>
			<appSettings>
				<add key="ConnectionString" value="server=(local);" />
			</appSettings>
		</configuration>

I am using a XmlDocument for my base implementation.

I am looking to see if there is a better way to add a new node / attribute than using
XmlDocument.InnerXml.  I would consider this to be a hack but couldn't really see another
way of doing this without defining namespaces and the like.

I have included the full file below and the lines that I am wondering about are lines: 79, 227, and 266

Thanks,
Dave


===================================

using System;
using System.Xml;
using System.Text;

namespace Storage.Utility.Configuration
{
	/// <summary>
	/// Class for Reading / Writing Configuration Options
	/// </summary>
	public class Configuration
	{
		#region Data Members

		private XmlDocument xmlDoc		= null;
		private XmlElement	root		= null;
		private XmlNode		node		= null;

		private string		filename	= null;
		private string		queryString	= null;

		#endregion
		
		#region Constructor

		public Configuration(string configFileName)
		{
			filename = configFileName;
		}

		#endregion

		#region Methods

		#region Miscellaneous

		/// <summary>
		/// Initialize the Configuration Class
		/// </summary>
		private void Initialize()
		{
			LoadConfiguration();
		}

		#endregion

		#region File Access

		/// <summary>
		/// Reload the Configuration File
		/// </summary>
		public void ReloadConfiguration()
		{
			LoadConfiguration();
		}


		/// <summary>
		/// Save the Configuration File
		/// </summary>
		public void Save()
		{
			SaveConfiguration();
		}


		/// <summary>
		/// Load the Configuration File
		/// </summary>
		private void LoadConfiguration()
		{
			try
			{
				xmlDoc = new XmlDocument();
				xmlDoc.Load(filename);
			}
			catch (Exception)
			{
				// Create Configuration File
				xmlDoc.InnerXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><configuration></configuration>";
			}
			finally
			{
				root = xmlDoc.DocumentElement;
			}
		}


		/// <summary>
		/// Save the Configuration File
		/// </summary>
		private void SaveConfiguration()
		{
			try
			{
				xmlDoc.Save(filename);
			}
			catch (Exception ex)
			{
				// Can't do anything
				throw (ex);
			}
		}

		#endregion

		#region Retrieve Values

		/// <summary>
		/// Get the Value of the Key 
		/// </summary>
		/// <param name="section"></param>
		/// <param name="key"></param>
		/// <returns></returns>
		public string GetValue(string section, string key)
		{
			try 
			{
				// Find the Node
				node = GetValueNode(section, key);
				if (node != null)
				{
					// Retrieve Value
					XmlNode valueNode = node.Attributes.GetNamedItem("value");
					return (valueNode.Value);
				}
			}
			catch (Exception)
			{
				// Nothing to do
			}

			// Error Occurred
			return (null);
		}

		
		/// <summary>
		/// Find the Node that the Key belongs to
		/// </summary>
		/// <param name="section"></param>
		/// <param name="key"></param>
		/// <returns></returns>
		private XmlNode GetValueNode(string section, string key)
		{
			try 
			{
				// XML Search Path
				queryString = "/configuration/" + section + "/add[@key=\"" + key + "\"]";

				// Look from the Root of the Document
				return (root.SelectSingleNode(queryString));
			}
			catch (Exception)
			{
				// Nothing to do
			}

			// Error Occurred
			return (null);
		}

		#endregion

		#region Store Values

		/// <summary>
		/// Store Key / Value in Configuration File
		/// </summary>
		/// <param name="section"></param>
		/// <param name="key"></param>
		/// <param name="keyValue"></param>
		/// <returns></returns>
		public bool StoreValue(string section, string key, string keyValue)
		{      
			try 
			{
				// Find Node if it exists
				node = GetValueNode(section, key);
				if (node != null)
				{
					// Update Value
					node = node.Attributes.GetNamedItem("value");
					node.Value = keyValue;
					return (true);
				}
			
				// Node Doesn't Exist -> Get/Create Section -> Add Key / Value
				if (GetSection(section) == true)
					return (CreateValueNode(section, key, keyValue));
			}
			catch (Exception)
			{
				// Nothing to do			
			}

			// Error Occurred
			return (false);
		}

		#endregion

		#region Create Nodes

		/// <summary>
		/// Create New Key / Value Entry
		/// </summary>
		/// <param name="section"></param>
		/// <param name="key"></param>
		/// <param name="keyValue"></param>
		/// <returns></returns>
		private bool CreateValueNode(string section, string key, string keyValue)
		{
			try
			{
				// Get Section
				queryString = "/configuration/" + section;
				node = root.SelectSingleNode(queryString);

				// Node Must Exist
				if (node != null)
				{
					// Create and Add New Key / Value Entry
					StringBuilder sb = new StringBuilder(500);
					sb.Append("<add key=\"");  sb.Append(key);		 sb.Append("\" ");
					sb.Append("value=\"");	   sb.Append(keyValue);	 sb.Append("\" />");  

					node.InnerXml += sb.ToString();
					return (true);
				}
			}
			catch (Exception)
			{
				// Nothing to do
			}

			// Error Occurred
			return (false);
		}


		/// <summary>
		/// Get / Create a New Configuration Section 
		/// </summary>
		/// <param name="section"></param>
		/// <returns></returns>
		private  bool GetSection(string section)
		{
			try
			{
				// Does the Section Exist
				queryString = "/configuration/" + section;
				node = root.SelectSingleNode(queryString);
				if (node != null)
					return (true);

				// Get the Configuration Node
				queryString = "/configuration";
				node = root.SelectSingleNode(queryString);
				if (node != null)
				{
					// Create a New Section
					StringBuilder sb = new StringBuilder(1000);
					sb.Append("<");   sb.Append(section);  sb.Append(">"); 
					sb.Append("</");  sb.Append(section);  sb.Append(">");  

					node.InnerXml += sb.ToString();
					return (true);
				}
			}
			catch (Exception)
			{
				// Nothing to do
			}

			// Error Occurred
			return (false);
		}
		#endregion

		#endregion

	} // Class
}

0
Webbert (6)
9/2/2004 12:52:31 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
3650 Views

Similar Articles

[PageSpeed] 11

"David Elliott" <Webbert@newsgroups.nospam> wrote in message news:2b5ej01vee1p82uoqo9a0os9g4alfia3g2@4ax.com...
> I am looking to see if there is a better way to add a
> new node / attribute than using XmlDocument.InnerXml.
: :
> but couldn't really see another way of doing this without
> defining namespaces and the like.

The example XML you've given doesn't contain any namespaces,
so why should you define one?

Have a look at the CreateElement() and CreateAttribute()
methods of XmlDocument, and then AppendChild() on XmlNode
(and remember that XmlDocument is an XmlNode, so it also
allows you to AppendChild() nodes to it).

> the lines that I am wondering about are lines: 79, 227,
> and 266


79: xmlDoc.InnerXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><configuration></configuration>";

If you set UTF-8 Encoding on an I/O Stream wrapped by an
XmlTextWriter (or TextWriter), this XML declaration will
be emitted for you automatically.

Here's how you'd create a custom XmlDeclaration for the
XmlDocument (note that if you do Save this XML to a
TextWriter-based class, its Encoding takes precedence).

    XmlDeclaration xmlDecl = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "");

Then you'd want to create your <configuration> element.

    XmlElement eRoot = xmlDoc.CreateElement( "configuration");

Finally, add the root element to XmlDocument and insert
the XmlDeclaration before it,

    xmlDoc.AppendChild( eRoot);
    xmlDoc.InsertBefore( xmlDecl, eRoot);


: :
223: StringBuilder sb = new StringBuilder(500);
224: sb.Append("<add key=\"");  sb.Append(key); sb.Append("\" ");
225: sb.Append("value=\"");    sb.Append(keyValue); sb.Append("\" />");
226:
227: node.InnerXml += sb.ToString();

    XmlElement eAdd = xmlDoc.CreateElement( "add");
    eAdd.SetAttribute( "key", key);
    eAdd.SetAttribute( "value", keyValue);
    node.AppendChild( eAdd);


: :
264: sb.Append("</");  sb.Append(section);  sb.Append(">");
265:
266: node.InnerXml += sb.ToString();

Your example code never gives a value to the argument,
section, but from your example XML I'll guess it's
<appSettings> (although I don't see where you have
inserted the child node between the start and end
elements).


    XmlElement eAppSettings = xmlDoc.CreateElement( "appSettings");
    eAppSettings.AppendChild( eAdd);
    eRoot.AppendChild( eAppSettings);


These three statements essentially tie together the
entire configuration document's XML nodes.

It looks like you own (because you want to own?) the
entire configuration file, but I'll also point out that
in the .NET Framework's System.Configuration namespace
are classes automatically supporting this configuration
schema to read a config file from "application.exe.config"
or "web.config".

Using the built-in configuration file support allows you
to create the element,

    <add name="key" value="keyValue" />

in a single statement like this,

    ConfigurationSettings.AppSettings[ key] = keyValue;

with the default NameValueSectionHandler.



Derek Harmon


0
loresayer (274)
9/3/2004 12:39:19 AM
Thanks,
Dave

"Derek Harmon" wrote:

> "David Elliott" <Webbert@newsgroups.nospam> wrote in message news:2b5ej01vee1p82uoqo9a0os9g4alfia3g2@4ax.com...
> > I am looking to see if there is a better way to add a
> > new node / attribute than using XmlDocument.InnerXml.
> : :
> > but couldn't really see another way of doing this without
> > defining namespaces and the like.
> 
> The example XML you've given doesn't contain any namespaces,
> so why should you define one?
> 
> Have a look at the CreateElement() and CreateAttribute()
> methods of XmlDocument, and then AppendChild() on XmlNode
> (and remember that XmlDocument is an XmlNode, so it also
> allows you to AppendChild() nodes to it).
> 
> > the lines that I am wondering about are lines: 79, 227,
> > and 266
> 
> 
> 79: xmlDoc.InnerXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><configuration></configuration>";
> 
> If you set UTF-8 Encoding on an I/O Stream wrapped by an
> XmlTextWriter (or TextWriter), this XML declaration will
> be emitted for you automatically.
> 
> Here's how you'd create a custom XmlDeclaration for the
> XmlDocument (note that if you do Save this XML to a
> TextWriter-based class, its Encoding takes precedence).
> 
>     XmlDeclaration xmlDecl = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "");
> 
> Then you'd want to create your <configuration> element.
> 
>     XmlElement eRoot = xmlDoc.CreateElement( "configuration");
> 
> Finally, add the root element to XmlDocument and insert
> the XmlDeclaration before it,
> 
>     xmlDoc.AppendChild( eRoot);
>     xmlDoc.InsertBefore( xmlDecl, eRoot);
> 
> 
> : :
> 223: StringBuilder sb = new StringBuilder(500);
> 224: sb.Append("<add key=\"");  sb.Append(key); sb.Append("\" ");
> 225: sb.Append("value=\"");    sb.Append(keyValue); sb.Append("\" />");
> 226:
> 227: node.InnerXml += sb.ToString();
> 
>     XmlElement eAdd = xmlDoc.CreateElement( "add");
>     eAdd.SetAttribute( "key", key);
>     eAdd.SetAttribute( "value", keyValue);
>     node.AppendChild( eAdd);
> 
> 
> : :
> 264: sb.Append("</");  sb.Append(section);  sb.Append(">");
> 265:
> 266: node.InnerXml += sb.ToString();
> 
> Your example code never gives a value to the argument,
> section, but from your example XML I'll guess it's
> <appSettings> (although I don't see where you have
> inserted the child node between the start and end
> elements).
> 
> 
>     XmlElement eAppSettings = xmlDoc.CreateElement( "appSettings");
>     eAppSettings.AppendChild( eAdd);
>     eRoot.AppendChild( eAppSettings);
> 
> 
> These three statements essentially tie together the
> entire configuration document's XML nodes.
> 
> It looks like you own (because you want to own?) the
> entire configuration file, but I'll also point out that
> in the .NET Framework's System.Configuration namespace
> are classes automatically supporting this configuration
> schema to read a config file from "application.exe.config"
> or "web.config".
> 
> Using the built-in configuration file support allows you
> to create the element,
> 
>     <add name="key" value="keyValue" />
> 
> in a single statement like this,
> 
>     ConfigurationSettings.AppSettings[ key] = keyValue;
> 
> with the default NameValueSectionHandler.
> 
> 
> 
> Derek Harmon
> 
> 
> 
0
dave871 (680)
9/3/2004 12:01:02 PM
Reply:

Similar Artilces:

'developer reference' help window font size...
hi all... I have excel 2007 and changed my screen resolution to (bigger) to view the help files. unfortunately with the ‘search scope’ set to ‘developer reference’ the font is tiny but with the other ‘search scopes’ the font is bigger than before. I have changed the ‘font size’ button in the help window to ‘largest’ but the font is still tiny. all help greatly appreciated and I thank all so much for your time and advice in advance. many many thanks. Paul. ...

Help Needed ... Probably simple for you gurus ... locking cell after data entered and
positioning next cell after enter is hit I am very computer illiterate and have searched and experimented for 2 days with limited success here is currently what the macro does when data is entered into a cell that cell is filled with the color green....simple...and works also there is 3 different columns with data being entered...A....B....C....after data is entered in C it automatically puts the current date in the corresponding cell in column D....that is somewhat ok...would like it to time stamp it also here is features that I would like to add Once data is entered to a cell I would l...

Help, can't shrink to fit so art prints on 1 page!
Working on a large banner, and want to share it with my team for review. Original file is 15mg, too large to send, and making a .pdf results in 45 pages of tiled images. Other desktop publishing software allows you to select a "fit to one page" or "scale" option so your image is reduced to one legal or letter sized sheet of paper. I can't even print this out to walk around and show my co-workers for comment. So - making a .pdf doesn't work, selecting Reduce then Fit to Paper Size won't work, asking to scale this to 20% won't work, printing to Offic...

Pivot Table Help #3
I have a lot of data that I am trying to analyze with a pivot table and am not sure how to go about it. Columns are (1) District (2) Store # (3) 2003 Score - these are #s or text ("incomplete") (4) 2004 Score - these are #s or text ("incomplete") For each district, I am trying to find out 3 things: (1) % of stores incomplete (2) Average score for 2003 & 2004 - I've got this one working properly (3) % change between 2003 & 2004 I can successfully analyze the data in a spreadsheet but there is too much to go through and thought a pivot table was the way to ...

Help! This is serious!
All of a sudden when I try to open an .xls file, it comes up with a page full of little "y"'s. What is wrong? I have data that I need to recover! I hope you have a backup. And keep your backups safe and offline. http://www.mvps.org/dmcritchie/excel/backup.htm Check your font in the fontbox Right click on the sheet tab, view code, anything in there? Tools, Autocorrect check the righthand column for y's Does this happen with just one worksheet, the entire workbook, all workbooks, all MS Office programs like Excel and MS Word. Does it happen on ne...

Help with Dates
Hi all, I have a table with field name "ConnectionDate". I want to create a form with ComboBox that will show the "ConnectionDate" as month and year only. The value the user will choose will be a criteria for a query. Please help. TIA, Tom ?Format(Date,"mmyyyy") would return 112007 so, SELECT Format(ConnectionDate,"mmyyyy") AS ConnectDate FROM SomeTable -- Dave Hargis, Microsoft Access MVP "Tom" wrote: > Hi all, > > I have a table with field name "ConnectionDate". > I want to create a form with ComboBox tha...

Event ID 125
I have received an Event ID 125 on an Exchange 5.5 server. Along with this I have an ID Error #193, 1005 7 and 100 amonst others. Is it possible that during a backup in schedule+ for a client on the client's machine, that the procedure corrupted the EDB.log or any other file? If so, should I be using Microsoft Base Article #275602 to repair. At this point, my Echange server is down. Thanks. Hello Deb Based on the limited information; the 275602 XADM: Microsoft Exchange Server Information Store May Stop After a http://support.microsoft.com/?id=275602 would be a recovery method. Did y...

Help, No pictures in Pub 2003
I installed Pub 2003 and none of my graphics are showing on my document. Does anyone know how I can fix that? Thanks Ed looks left. Ed looks right. No-one is there. Furtively, Ed picks up a note from Xeroid <lnerbonne@cogeco.ca>. On it is written: > I installed Pub 2003 and none of my graphics are showing on my > document. Does anyone know how I can fix that? View > Pictures...? -- Ed Bennett - MVP Microsoft Publisher http://www.mvps.org/the_nerd/ Before reading this message, view the disclaimer: http://mvps.org/the_nerd/disclaim.htm when I open a Pub made file fro...

IFD install needed help
Hi, After facing many errors and difficulties during the CRM 4.0 installation I successfully installed the product. Now I am trying to install CRM as IFD. I want to install IFD without any problems So I have some questions. What is the SDK root domain and web application root domain mean? Is the below config file format is alone enough for IFD installation. Is there anything else i need to look up.?? I went through the MSDN documentation. Can anyone guide tell me how and what configurations i should use to install IFD successfully. <CRMSetup> <Server> <ifdsettin...

Need to remove help compile in project
Can someone tell me how to remove the help build process from a project? Thanks What does this mean? You want to remove part of the build? If yes, just remove those files from project. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "mike" <nospamplease.com> wrote in message news:%236ooDIkGHHA.1468@TK2MSFTNGP04.phx.gbl... > Can someone tell me how to remove the help build process from a project? > Thanks > > I've tried removing the help files but when I build, the help compiler is still invoked. The project show a couple of .rtf files in the dependenc...

Need Help Troubleshooting Report Manager
Here is my situation. I can=92t get to Report Manger via IE. IE just displays the =93Internet Explorer cannot display the webpage=94 error message. Details: OS is Server 2008 Standard. I=92m running a standalone computer =96 not connected to the internet. I=92ve installed MS Loopback Adapter. I=92ve installed SQL Server Reporting Services and it=92s running ok. I verified by going to Services. Status is Started, Startup Type is Automatic. The account I=92m logged in as is a member of the Administrators Group. Windows Firewall is off for all profiles. Under Network Connections ...

HELP with Office 2004 not loading after installing Adobe Acrobat 7.
Hi, Word, Excel and Powerpoint won�t launch anymore after installing Adobe Acrobat 7. I checked on office/startup and the three folders are empty. All I get is window telling me that app couldn�t launch.. Error reporting. Is there a way to fix this? I don�t want to reinstall OSX. I have uninstalled and reinstalled Office several times to no avail. Entourage launches fine. Thanks, AJ There are troubleshooting techniques linked from this page, work through them: http://www.mcgimpsey.com/macoffice/ see General Troubleshooting and Troubleshooting for Office 2004 If they get to the splash sc...

create xml document based from schema
I have the following schema. I need to know how to make an xml document based from it. The main worry I have is the DateTime field. <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="NewsArticle"> <xs:complexType> <xs:sequence> <xs:element name="Description" type="xs:string" /> <xs:element name="Body" type="xs:string" />...

creating labels
hi, how can i create labels so I can input about 100 names and they will print off in a label style, Ive tried everything please help!! -- \m/ O_O \m/ Laura..... :) Liverpool, England Laura, I would do a mail merge with word, For help on Word mail merge using Excel as the data source have a look here http://www.mvps.org/word/FAQs/MailMerge/CreateAMailMerge.htm http://www.mvps.org/word/FAQs/MailMerge/CreateADataSource.htm http://www.mvps.org/dmcritchie/excel/mailmerg.htm -- Paul B Always backup your data before trying something new Please post any response to the newsgroups s...

Creating a new default message template
I have a email template that I want to make the default. In other words, when you click on New to create a new email, I want the message template that I have created to come up as the default. Does anyone know how to do this? What you are proposing is a very bad idea. Using a custom form as the = default for new messages will guarantee that non-Outlook recipients = won't be able to read attachments you send.=20 I'd suggest that you back up and explain what functionality you were = hoping to add by changing the message form, and in what version of = Outlook.=20 --=20 Sue Mosher, ...

can't reply or can't create
I have Outlook 6.0 in my Windows 2000 computer. I can't reply or create new message but I can read the message. The "Reply" "new" "forword" and "reply all" button are dead. I can't highlight those button. Does anyone has any problme of this? Plez let me know <mmdir2002@yahoo.co.uk> wrote in message news:1106036722.098189.74470@c13g2000cwb.googlegroups.com... > > I have Outlook 6.0 in my Windows 2000 computer. > I can't reply or create new message but I can read the message. > The "Reply" "new" "f...

FORMATING COLUMNS..... HELP
I need to format columns to allow only 7 characters and the rest of the data to go into column B -- JTEFUN "JTEFUN" <JTEFUN@discussions.microsoft.com> wrote in message news:6C5C7A99-E83F-430E-9576-6D1DB57B9311@microsoft.com... >I need to format columns to allow only 7 characters and the rest of the >data > to go into column B > -- > JTEFUN > If you mean that if a user types a lot of data into the one cell and that when they reach 7 characters the rest of the data is automatically inserted into the next cell, then I don't think you can do that....

COleSafeArray::Create throws CMemoryException
Hi why does COleSafeArray::Create throw a CMemoryException if the array to create is larger than ullAvailPhys but smaller then ullAvailVirtual as returned by GlobalMemoryStatusEx Are all safearrays kept in physical memory and not swapped to page file I use Windows XP Thank HS ...

Need to create an automatic hyperlink
I'm using Excel 2003, Windows XP. Okay I have a workbook with a main spreadsheet and about 150 other spreadsheets with images in them. I have the names of the other spreadsheets in cell b2. How do I create a hyperlink that will concantenate the name in cell b2 to a hyperlink and point it to the spreadsheet with that name? I know I can do it by manually selecting each cell and hyperlinking manually, but with over 150 it's taking a while. Thanks. I tried =HYPERLINK("file:////"&b2,"Click me!") and it fails (can't find specified file)...

limit create window/control max count?
Hi all. I am testing a create control. But I want create many control (more 10000) in dialog. I test dynamic create CButton. It's created about 9800. I want work. 1. have a two dialog.(A, B) 2. A dialog has 40 controls(Button, Spin, static). 3. B dialog has contain A dialog. A dialog is more than 200. 4. create A dialog dynamic.(Using A->Create(IDD, this)) and attach B dialog. A dialog is modaless. 5. But not create about 190. dialog create function return 0. thank for read. Have a nice day. You need to redesign your system, IMO. -- - Mark Randall http://zetech.swehli.com...

Outlook help
Hello. After years of using Outlook on my Windows XP machine, now I get the following error: Cannot start Microsoft Office Outlook. Unable to open the Outlook window. The set of folders could not be opened. The server is not available. Contact your administrator if this condition persists. Can anyone help? Where is the actual data kept? Can I retrieve it? Can you open Outlook in Safe Mode by using the /Safe switch? If you need help using Outlook command line switches, look here: http://support.microsoft.com/default.aspx?scid=kb;en-us;296192 -- Jocelyn Fiorello MVP - Outlook ...

need help with list box?
Hi I have a huge table of about 20000 records. how can I restrict entry for a few columns. I am new to excel programming. For example. I have a list of colors (red, green, blue) that I want to go under the Color column. how can I allow the user to click on a pulldown or list box similar to ms access for each cell. thanks in advance. Hi you could use 'Data - Validation'. See: http://www.contextures.com/xlDataVal01.html >-----Original Message----- >Hi > >I have a huge table of about 20000 records. how can I restrict entry for a >few columns. >I am new to exc...

Running Office 2001 on Mac OS 10.2, help
This might be a dumb question, but I don't want to screw things up. I was running Mac OS 9.0.4 and I downloaded OS 9.1, 9.1.2, 9.2.2 and then the new 10.2. However, all my software is still in the 9.1 classic. I want to use it all in the new OS 10.2. Will Office 2001 Academic Edition work in OS 10.2? Do I need to uninstall it in OS 9.1 first, then install it is OS 10.2? Or, can I just drag and drop it on the 10.2 desktop or in the applications folder? I have a lot of other expensive softwares in OS 9.1 that I don't want to have to upgrade, but need to be able to use in OS 10.2. Wi...

Problem creating 2003 PST file
Hi, I am currently running Outlook 2003 (Client). I am trying to create a new PST file. However when I try to add a new file (file\new\outlook data file\) I can only select: Outlook 97-2002 Personal Folder File. On the microsoft website it says I should see something like "Office Outlook Personal Folders File (.pst)" but it is not listed. Is there any way to correct this?? I am running Outlook 2003 SP1. Thanks for any help, Wouter Hi, Kan iemand mij helpen? Het moet mogelijk zijn om bij het verzenden van een emailtje de afzender te veranderen. Ooit wist ik het, maar ik ben...

Creating users via powershell
I am using the windows powershell cmdlets to set up new users automatically in AD 2003. I am particularly using the cmdlets from quest such get-qaduser and new-qaduser. To setup bulk number of users I have to setup a csv file and then import them into the script. The script is below: #Get-UserGroups.ps1 #sample CSV heading # "Name,Firstname,Lastname,SAMAccountname,Telephone,Office,Department,Title,City,Company" $file="C:\employees.csv" if ((Get-Item $file -ea "silentlycontinue" ).exists) { Import-Csv $file | ForEach-Object { ...