Showing posts with label Others. Show all posts
Showing posts with label Others. Show all posts

Jul 30, 2012

The POP3 service could not create the mailbox – the account already exists

In Windows Server 2003, I have configured POP 3 service, created domains and mailboxes.
I have created many users and associate mail boxes in the POP3 service and deleted for some reasons.
When I try to create the same user I have got the error:
The POP3 service could not create the mailbox - The account already exists

Even on manually deleting the folders (mailboxes created for each user created), I got this error.
Reason:
Then I came to know that the user associated with the mailbox is not deleted.
Right Click on My Computer -> Manage -> Administrative Tools -> Computer Management -> System Tools -> Local Users and groups -> Users -> Delete the user account for which you are unable to create the mailbox.
Note: Check the user associated with any other applications or any services before deleting the user.
Now, try creating the mailbox, you will be able to create the mailbox successfully!

Jul 27, 2012

Download Image from Right Click Disabled Website

In this article, we will know a small trick where we can download the images from the web page in which the right click is disabled in the web page.
Usually, web masters will disable the right click on the web pages in order to protect the content in the web page.
But sometimes, we need to download the images or copy the content from the web pages. Following are the different steps:
1. In the web page, only Right Click is disabled. Hence, we will use LEFT CLICK. Point the image and left click on the image and then drag the image to the desktop or to the address bar in the browser. Hurray! You can save the image.
2. In Internet Explorer, we can disable the active scripting and copy the image. The reason behind this is kind of scripting is written using “JAVA SCRIPTS”.Got to IE -> Tools -> Internet Options -> Security Tab -> Custom level -> Go to Scripting -> Active Scripting -> Disable -> Click OK and restart the browser
3. In Mozilla Firefox  the steps is as follows:
Open the browser -> Go to Tools -> Options -> In the Content Tab -> Uncheck or Deselect the Enable JavaScript -> Restart the browser
There are many third party tools which enable to download the images and contents. But the above are the few easy steps to achieve the goal!

Jul 1, 2012

Prevent Outlook from Sending Emails with a Blank Subject

Objective:
In the IT Industry, Outlook is most popularly used as the Email client. The subject line is a very important part of any email. Many times has it happened to you that you have sent an email through Outlook without a subject line? After clicking the Send button, you realize that you have made a mistake (What if it is a case you have sent a mail without Subject to a Client or a Manager?)
By default, Outlook does not validate a mail with a blank subject and here is the solution.
Steps:
1. Open MS Outlook -> Tools -> Macro -> Visual Basic Editor
2. You will see Visual Basic Editor will be opened 
 3. Click ThisOutlookSession which will open the Code Editor paste the below code in the Editor -> Save it and Close the window.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
   Dim strSubject As String
   strSubject = Item.Subject
   If Len(Trim(strSubject)) = 0 Then
       Prompt$ = "Subject is Empty. Are you sure you want to send the EMail?"
      If MsgBox(Prompt$, vbYesNo + vbQuestion + _
            vbMsgBoxSetForeground, _
            "Email Subject is Empty") = vbNo Then
        Cancel = True
      End If
  End If
End Sub
4. Now, restart the outlook. You will be prompted with a window where in Click on Enable Macros.
5. Now try sending an email without subject, you will be prompted for entering a Subject in the Email.

Jun 5, 2012

Install and Configure E Mail Server in Windows Server 2003

In this article, we will see how to Install, Configure and use the Mail Server in Windows Server 2003.
Steps for Installing Mail Server:
1. You can install the Email Server by using Add or Remove Windows Components or Manage Your Server. Go to start Manage Your Server by clicking Start-> Programs->Administrative Tools->Manage Your Server.
2. This will open the Configure Your Server Wizard as shown below
Read the instructions properly and check all the steps in the pop up window are completed in the server.
3. Now Click Next button. The wizard will now check the network settings. Now Click on add the Mail Server (POP3, SMTP) from the list of options available. 

4. Click on Next and you will now specify the type of authentication and type the email domain name. In this tutorial we will use Windows Authentication, and I have used testdomain.com
 5. Now Click on Next. First it will ask for the confirmation for the selected roles and then installation will start, and will also start the Windows Components Wizard as shown below


When you get prompted to insert your Windows Server 2003 CD-ROM into your CD-ROM drive, insert the Win Server 2003 CD in order to complete the installation.
After inserting the CD or locating the I386 Files in a folder, the configuration wizard will complete the installation as shown below:
We have now successfully installed the mail server.
Steps for Configuring Mail Server:
We have installed the Mail Server and next are configuring the mail server for sending mails which includes creating mail boxes in the mail server.
1. Click Start -> Run and type p3server.msc. This will open up the POP3 Service.
2. Here we will configure the mails server. Now Click on ComputerName in the left pane and Click on Server Properties in the right pane as shown below:
Here you can configure the properties of the Mail Server.
3. While Installing the mail server, we have created the domain (here testdomain.com). If you need to create a new domain, then you can click on New Domain in the Right Pane and create it.
4. Click on the created domain (testdomain.com) in the left pane and Click Add Mailbox in the right pane.
Give the Mailbox Name and password to create a new mail box.
Click On OK, so that the mail box is created.
5. In the mailbox list, you can see the newly created mailbox listed in it.
In the same way any number of users and mailbox can be added.
Hope this helps you!
Please free to comment and share this post if it helps you. 

May 23, 2012

Error: The language-neutral solution package was not found.

While using Visual Studio, you may get the following error
“The language-neutral solution package was not found.”
Solution:
There are three ways you can fix this problem:
1. This may be caused due to the CACHING issue in the Visual Studio and hence restarting the Visual Studio will help you in fixing the issue.
2. Sometimes the solution you are trying to update will not get updated properly. Hence delete the following folders (By navigating to In Visual Studio   -> Right click on project in Solution Explorer window -> Select Open folder in Windows Explorer)  bin, obj and package.
After deleting these folders, rebuild and deploy the solution which will work out.
3. Or finally, you can retract the solution from the Central Admin (in case of SharePoint related issues) and then uninstall the solution dll from the assembly folder. Then try to deploy the solution.
Please free to comment and share this post, if this helps you!

May 16, 2012

Windows System Shows Blank Screen after logging in

Scenario:
I have faced many situations like after logging into the Windows Operating system machine (Especially Windows 7 and Windows Server which I have faced); it takes more hours showing a BLANK SCREEN without showing the desktop. It wasted my time more. So I was searching for a solution which would help in fixing the issue.
Solution:
1. Press CTRL + ALT + DEL
2. Select Start Task Manager from the list
3. In the Task Manager Select -> File -> New Task (New Task (Run...)) – I have Win 7 as shown below:
4. Type “Explorer” in the text box and click OK.
5. Now, you will see the explorer opening suddenly and also your desktop is ready to use.
Hope this helps some one’s time. Happy Sharing!

May 1, 2012

RegisterForEventValidation can only be called during Render()

To know about creating a Grid view with Paging and Exporting the view to Word and Excel documents read this article.
The following is the screen shot which you get due to this error:


This error occurs whenever we are trying to render control to response. To fix this problem I have added EnableEventValidation="false" to @Page directive of aspx page.
This will look like as follows:
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" EnableEventValidation="false" %>
This code will fix this issue.

Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server

To know about creating a Grid view with Paging and Exporting the view to Word and Excel documents read this article.
The following is the screen shot which you get due to this error:


This error occurs whenever you are trying to export the grid view data to excel or word. This occurs due to the reason that the compiler thinks that the control is not added in the form. Hence to resolve this issue, add the overriding function in the code
public override void VerifyRenderingInServerForm(Control control)
{
  /* Verifies that the control is rendered */
}

This code will fix this issue.

Grid View with Paging into Excel and Word in ASP.Net

After reading this article, you will come to know the following:
   1.   Using grid view control in the ASP.Net applications
   2.   Creating and connecting the SQL database in the ASP.Net applications
   3.   Creating PAGING in the grid view
   4.   Tabbed navigation in the ASP.Net application with single GRIDVIEW
   5.   Converting the grid view with paging to WORD and EXCEL document

Scenario:
   1.   We have to use grid view to display the details from the SQL database
   2.   We have to use single grid view control to display details from two different tables from the database
   3.   We have to enable PAGING in the grid view control
   4.   We have to convert the details displayed in the grid view to word and excel document

Solution:
   1.   I have created an ASP.Net Web application using Microsoft Visual Studio 2005.   
   2.   I have placed two buttons (as tabbed navigation) for displaying the details from two different tables in two tabs.
   3.   Also, you will find the solution for paging in the grid view control.
   4.  Then, after displaying the details, we can convert the details to word and excel document.
    
Code (.cs file):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
public partial class _Default : System.Web.UI.Page
{ 
    String strDetails = String.Empty;
    SqlConnection conn = new SqlConnection("Data Source=ServerName;Initial 
    Catalog=Database Name;Integrated Security=True");
    protected void Page_Load(object sender, EventArgs e)
   {
        if (!IsPostBack)
        {
            BindData(strDetails);
        }       
        GridView1.PageIndexChanging += new GridViewPageEventHandler(GridView1_PageIndexChanging);
    }        
    protected void btn1_Display_Click(object sender, EventArgs e)
    {
        strDetails = "";
        GridView1.PageIndex = 0;
        BindData(strDetails);
    }
    protected void btn2_Dipslay_Click(object sender, EventArgs e)
    {
        strDetails = "UserGroup";
        GridView1.PageIndex = 0;
        BindData(strDetails);
    }    
    protected void btn_ExportExcel_Click(object sender, EventArgs e)
   {              
        Response.Clear();
        Response.AddHeader("content-disposition","attachment;filename=FileName.xls");
        Response.Charset = "";
        Response.ContentType = "application/vnd.xls";
        System.IO.StringWriter stringWrite = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter htmlWrite =new HtmlTextWriter(stringWrite);
        //turn off paging before exporting the details
        GridView1.AllowPaging = false;
        strDetails = ViewState["strDetailsValue"].ToString();
        BindData(strDetails);
        GridView1.RenderControl(htmlWrite);
        Response.Write(stringWrite.ToString());
        Response.End();
        //turn the paging on again after writing the values to the excel document
        GridView1.AllowPaging = true;
        BindData(strDetails);
        Response.Flush();
   }
    protected void btn_ExportWord_Click(object sender, EventArgs e)
   {
        Response.Clear();
        Response.AddHeader("content-disposition", attachment;filename=FileName.doc");
        Response.Charset = "";
        Response.ContentType = "application/vnd.ms-word ";
        StringWriter sw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(sw);
        //turn off paging before exporting the details
        GridView1.AllowPaging = false;
        strDetails = ViewState["strDetailsValue"].ToString();
        BindData(strDetails);
        GridView1.RenderControl(hw);
        Response.Write(sw.ToString());
        Response.End();
        //turn the paging on again after writing the values to the excel document
        GridView1.AllowPaging = true;
        BindData(strDetails);
        Response.Flush();        
    }
    private void BindData(String strDetails)
    {
        DataSet ds = new DataSet();
        conn.Open();
        SqlCommand cmd;
        if (strDetails == "UserGroup")
        {
            cmd = new SqlCommand("Select * from table1", conn);
        }
        else
        {
            cmd = new SqlCommand("Select * from table2", conn);
        }
        SqlDataAdapter sqlAd = new SqlDataAdapter(cmd);
        sqlAd.Fill(ds);
        GridView1.Controls.Clear();
        GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();
        GridView1.Visible = true;
        ViewState.Add("strDetailsValue", strDetails);
        conn.Close();     
    }
   //Handling the paging event in the grid view control 
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        strDetails = ViewState["strDetailsValue"].ToString();
        BindData(strDetails);
    }
    public override void VerifyRenderingInServerForm(Control control)
    {
      /* Verifies that the control is rendered */
    }
  }
Hope this helps you! Please free to comment and share this post.
If you are getting the following error:
RegisterForEventValidation can only be called during Render();
Read this article to fix the error.
If you are getting the following error:
Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server.
Read this article to fix the issue.

Jan 11, 2012

Reading the Custom Properties of MS Office Word 2007 & 2010 documents

Earlier, we have discussed about reading the Summary and Custom Properties of Word 2003 using DSO DLL.
Here are the articles references

As already mentioned in the above articles, DSO dll is a 32 bit and also it has OLE property reader class, which can read only the office 2003 documents.
The same DSO file cannot be used for reading the properties of 2007 & 2010. This is because, word 2003 stores the properties in OLE type and hence DSO has capabilities to read the properties. But word 2007 and 2010 stores in XML formats.

Want to know how the office 2007 & 2010 stores the properties in XML formats?
Change the extension of word 2007 or 2010 documents from .docx to .zip. Now extract the contents.
You will see many xml files inside that folder.
Now open the folder -> docProps folder -> 3 files will be there                     
 1.  App.xml – it stores the document’s summary properties
     2.   Core.xml – it stores the document’s summary properties
     3.   Custom.xml – it stores the document’s custom properties
The below snap shot shows the custom.xml file of a word 2007 document
It is possible to read the custom properties of word document using Office DLLs (which is deployed when you install a MS office in a machine).
But how to read the properties without using Office DLLs?
Hence, we will go for an open source dll provided by Microsoft called Open Office XML SDK 2.0.
The same can be downloaded from the below link
It has the capabilities to read the xml properties from the MS office documents.

Code snippet for reading custom the properties of word 2007 & 2010

public Dictionary<string, string> WDGetCustomProperties(string filename)
{
using (var package = WordprocessingDocument.Open(filename, false))
{
var properties = new Dictionary<string, string>();
var customProps = package.CustomFilePropertiesPart;
foreach (var property in package.CustomFilePropertiesPart.Properties.Elements<CustomDocumentProperty>())
{
                    if (property.Name == "Name")
                        Name = Convert.ToString(property.InnerText);
                    if (property.Name == "Expertise")
                        ExpertiseIn = Convert.ToString(property.InnerText);
                    if (property.Name == "Place")
                        Place = Convert.ToString(property.InnerText);
}
 return properties;
}
}
Note: Don’t forget to declare the 3 variables used for storing the values in theabove code.
Hence, this article shows you how to read the custom properties of the word 
2007 & 2010 documents.
To know how to create the custom properties in the Word 2007 & 2010 read 
this article.
Hope this helps You! Please free to comment.

Dec 15, 2011

Creating Custom properties in Word 2003

In the articles Part I,Part II and Part III we have discussed about how to read the custom properties of word 2003 using  DSO dll in C# .Net.
In this article we are going to see about creating a bookmark and set the custom properties for the Microsoft Word 2003.
Steps
1. Open the Microsoft Word 2007 and create a new word document.
2. For creating the Bookmark, we need Forms option in the Microsoft Word Menu.
3.  Right click on the Menu bar and you will see forms options and check the option you will see the forms menu
4.   Then click the Textbox option (will be having a symbol ”ab”)

5.  Insert a text box and mouse click to see the properties.
6.   Now in the Bookmark option give the property name (here I gave it as CompanyName )

7. Now go to File Menu->properties-> Custom properties tab as shown below

8.  Now in the Name field give the Name (I gave as TestCompany) and check the Link to Content so that you will see the bookmark created and link the content we have created (CompanyName)
9. Now you will see the added property as below.

10. Click Add and now the properties are set. If you type a value in the document, the value must be assigned and you can see in the properties as shown below.
So, once the properties are set we can read the values using c# .Net.
Enjoy! 




Dec 11, 2011

Reading Custom Properties of Word Document

Part III
Read the Introduction about this article Part I
Read about reading the summary properties of word document in this article Part II
In this post, we can see what is the code for the reading the custom properties of the word document.
public static void GetDocumentCustomProperties(string filename)
{
            OleDocumentPropertiesClass doc = new OleDocumentPropertiesClass();
            doc.Open(filename, true, dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess);
            //Reading and writing the custom properties to a file
            StreamWriter sw1= new StreamWriter(@"D:\FileRead_Custom.txt");
            CustomProperties obj_CustomProp = doc.CustomProperties;
            foreach (CustomProperty custom_prop in obj_CustomProp )
            {
                sw1.WriteLine(custom_prop.Name   "    "   custom_prop.get_Value());
            }
            sw1.Close();
            doc.Close(false);
}
Hope this helps you!

Reading Summary Properties of Word Document

Part II
Read the Introduction about this article Part I
In this post, we can see what is the code for the reading the summary properties of the word document.
public static void GetDocumentSummaryProperties(string filename)
{
            DSOFile.OleDocumentPropertiesClass doc = new DSOFile.
            OleDocumentPropertiesClass();
            doc.Open(filename, false,

            DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess );

            //getting the properties of the document
            DSOFile.SummaryProperties summaryProp = doc.SummaryProperties;

            //reading and writng the summary properties to a file
            string author = summaryProp.Author;
            string comapanyName = summaryProp.Company;
            string managerName = summaryProp.Manager;
            StreamWriter sw = new StreamWriter(@&quot;D:\FileRead.txt&quot;);
            sw.WriteLine(author);
            sw.WriteLine(comapanyName);
            sw.WriteLine(managerName);
            sw.Close();
}
That’s It. Enjoy Happy Coding!
Also, read how to Read the Custom Properties of Word Document Part III

Reading Document Properties

Part I
We are going to discuss about a interesting topic which can be used in SharePoint and also in .Net.
It is possible to reading the summary properties and custom properties of the word document and it is also one of the requirements now a days.
This can be done through using DSO dll which can be downloaded from the below link
(Important Note: This is a 32 bit dll )

What is DSO dll ?
The Dsofile.dll sample file is an in-process ActiveX component for programmers that use Microsoft Visual Basic .NET or the Microsoft .NET Framework. You can use this in your custom applications to read and to edit the OLE document properties that are associated with Microsoft Office files, such as the following: 
• Microsoft Excel workbooks
• Microsoft PowerPoint presentations
• Microsoft Word documents
• Microsoft Project projects
• Microsoft Visio drawings
• Other files that are saved in the OLE Structured Storage format
The Dsofile.dll sample file is written in Microsoft Visual C++. The Dsofile.dll sample file demonstrates how to use the OLE32 IPropertyStorage interface to access the extended properties of OLE structured storage files.
Features of this DLL
1. This dll is 32 bit and can read only Microsoft word 2003 (ie., .doc) formats only.
2. It has a OLE property reader class which can read the properties of the word document.
3. Using this dll, we can read both the Summary properties and also the Custom properties we create for the documents.
4. Also with this dll, we can set the custom properties programmatically.

Also, Read how to extract the summary properties of the word document in this article Part II.

Dec 9, 2011

Recommendations for maintaining Infopath performance

I'm creating an InfoPath form that is a bit large and starting to lag so I decided to look up better practices for developing InfoPath forms to maintain performance. Here is what I found online:
- Keep views from being too large or complex. Split large views into several smaller ones with buttons to switch between them.
- Avoid lots of tables (data or layout) in any single view.
- Use Master/Detail to reduce the number of controls in one page, whenever possible.
- Try to use filter to filter the table rows (instead of conditional
formatting).
- Avoid large repeating data structures that can grow to many pages.
-Avoid complex nesting of optional and repeatable sections. These are quite complicated to layout and also can quickly cause a single view to become very large.
- Avoid using Percentage width for your controls if your view contains lots of nested controls. We have seen over 50% improvements by using Fixed Width. You can apply specify a fixed width in the control's properties dialog.
- Be aware of exactly what your business logic does. For example, onAfterChange can fire multiple times for a single edit.
- Rather than querying for all the data then having InfoPath just show a small amount, refine your query and only bring the data you plan on displaying into InfoPath.
- Only get the data you need to load the form. Don't pre-populate data sources that aren't necessary on load.
- Merge static xml data sources into one if you have multiple xml data connections.
- Use Expression Box to display calculated value if you don't need to store the value. If you have business logic to trigger all the calculation, only trigger necessary calculation. Triggering large amount of calculations is costly.
- When using digital signatures, only digitally sign the information you need to. Signing takes a screenshot of the data signed and encodes it in the form. The larger the screenshot, the larger the xml will become with the encoded image.
- Avoid attaching large files to the form. These files are encoded in the xml and can cause issues if they become too large. Provide links over embedding large files if possible.
- Avoid embedding images in a form. For the same reasons as above.

Nov 24, 2011

What is 12 and 60 Hive in SharePoint ?

You'll hear SharePoint people talk about and refer to the "12 Hive" or the "60 Hive" regularly. We don't know what it is and we use it .

The "Hive" concept was coined by Todd Bleeker. So what does it mean?
12 Hive is the location where MOSS 2007 and WSS 3.0 install their files on the file system. 
The same thing applies to 60 Hive which, as you may guess is the location of SPS 2003 and WSS 2.0 files. 

Locations:
12 Hive C:\Program Files\Common Files\Microsoft Shared\web server extensions\12
60 Hive C:\Program Files\Common Files\Microsoft Shared\web server extensions\60

Nov 20, 2011