soum-net
Wednesday, May 12, 2004
using System.Runtime.InteropServices;
using word;
class Tester {
public static void Main() {
try {
object o = Marshal.GetActiveObject("Word.Application");
_Application app = o as _Application;
Console.WriteLine(app.Version);
}
catch (System.Runtime.InteropServices.COMException)
{
Console.WriteLine("Make sure Word is running");
}
// Release COM object when done !
}
}
release karne ke liye
Marshal.ReleaseComObject;(0);
Sunday, May 09, 2004
Tuesday, May 04, 2004
.Try this kool stuff.
Save the following content enlosed between (* lines) as Temp.TPL (in your C: drive)
*************************************************************************************************************
Books For Sale
| Title | Price |
|---|---|
| <%insert_data_here%> | $<%insert_data_here%> |
<%insert_data_here%>
| ID | Publisher's Name |
|---|---|
| <%insert_data_here%> | <%insert_data_here%> |
<%insert_data_here%>
*************************************************************************************************************
In the above tpl file,the HTML code between <%begindetail%> and <%enddetail%> are the markers. The portion within these markers are repeated for each row of the recordset in the output file generated. The first <%insert_data_here%> marks where the first field of the recordset will be inserted and so on.
No execute the following :
####################
USE pubs
GO
EXECUTE sp_makewebtask @outputfile = 'C:\Temp.HTML',
@query = 'SELECT title, price FROM titles SELECT au_lname, au_fname
FROM authors SELECT pub_id, pub_name FROM publishers SELECT au_lname,
au_fname FROM authors', @templatefile = 'C:\Temp.TPL',
@dbname = 'pubs', @rowcnt = 5, @whentype = 9
GO
####################
For more options, look for "sp_makewebtask" in your books online.
Sunday, May 02, 2004
change to the C:\Program Files\Microsoft.NET\FrameworkSDK\bin directory and then type: tlbimp "C:\Program Files\Microsoft Office\Office\msoutl9.olb" /out:"C:\Office Sample\msoutl9.dll" This will create an interop dll for Outlook
2) Start an Outlook Session by using the ApplicationClass instance and using its logon() function call.
using Outlook;
Outlook.Application outlookApp = new Outlook.ApplicationClass();
Outlook.NameSpace outlookSes = outlookApp.GetNamespace("MAPI");
outlookSes.Logon ("exchtest","net",false,true);
Here the ApplicationClass will create an instance of the outlook and the GetNamespace() function call will create a new outlook profile (session). The logon() function takes parameters in this order :- profile,password,showdialog,newsession
3) Now we can get into any of the folders outlook maintains in itself. Lets say we want to get into Inbox folder :-
Outlook.MAPIFolder inboxfolder;
inboxfolder = outlookSes.GetDefaultFolder(Outlook.OlDefaultFolders. olFolderInbox);
Outlook maintains its Folder dir in an enum called "OlDefaultFolders" frm where u can choose whichever folder u want. NOw once the folder item u get u can enumerate thru it to check ur mails or u can also use fiter to filter out unread mails from them.
as shown below.
Outlook.Items unreadItems = inboxfolder.Items.Restrict("[UNREAD] = true");
so happy outlooking :)