.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Problem with Using Outlook Reference on C#

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :ASP.Net

hey guys, 

I followed steps of others' article about opening a outlook email window with C#

After completed the code, It works perfectly fine when I tested it using Visual Studio 2008.

However, When I open my website directly, it shows Error Page!!!

Any ideas why this strange thing happens???? Thanks first!

here is my code:

using Outlook = Microsoft.Office.Interop.Outlook;

protected void btn_sendbyEmail_Click(object sender, EventArgs e)
        Outlook.Application outlookApp = new Outlook.Application();
        Outlook.MailItem outlookmail = (Outlook.MailItem)outlookApp.CreateItem(Outlook.OlItemType.olMailItem);
        outlookmail.Subject = "Attaching Chart";
        outlookmail.Body = "this is a mail for sending chart";
        int attachmentLocation = 1;
        outlookmail.Attachments.Add(ServerPath, Outlook.OlAttachmentType.olByValue, attachmentLocation,"chart!");//ServerPath is defined.

View Complete Post

More Related Resource Links

Sharepoint check-out document cross reference problem

Hi I have a problem with check-outed word document from Sharepoint Services 3.0. After I check-out document from Sharepoint, cross references in Word document stop working. After I click to cross reference (Ctrl+Click to follow link), Word show me warning message: "Some files can contain viruses or otherwise be harmful to your computer...Would you like to open this file". There is two buttons - OK and cancel. After pressing OK nothing happens. I have Sharepoint Services 2003 (clear installation, no custom code), MS Word 2007 and trying .doc file format. I tried this on two Sharepoints and two client computers, but it is the same. I tried http://support.microsoft.com/?scid=kb%3Ben-us%3B925757&x=8&y=9 , but did not help. How can I disable this behavior? Thanks

Outlook web access - my calender log in problem

Hi there. We have an intranet solution built on Sharepoint 2010 enterprise. I'm trying to connect the My Calendar web part(found under Outlook web access web parts) to my clients outlook exchange -server. I've set the server to be https://webmail.[company].fi/exchange and the credentials in the web part properties. I get the signing in -part to show on my web part but for some reason cannot log in. There is no error or notification about what went wrong with the login. When I open up a new tab and go straight to https://webmail.[company].fi/exchange and log in with the same credentials that I tried on the web part, I can log in. Now when I go back to my original tab -having the my calendar web part- and refresh, the web part suddenly works and it displays the calendar as it's supposed to. Why can't I log in directly in the My Calendar web part? What could be the problem? Thanks in advance

Visual Studio 2008 Cross Reference Problem


Hi to all

I got following warning when I opens my solution...

Warning 1 There is a circular reference involving the import of file "C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.CompactFramework.CSharp.targets". This file may have been imported more than once, or you may have attempted to import the main project file. All except the first instance of this file will be ignored. EM.ShoppingCart

"There is a circular reference involving the import of file "C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.CompactFramework.CSharp.targets". This file may have been imported more than once, or you may have attempted to import the main project file. All except the first instance of this file will be ignored."

I got this error after my VS 2008 crashed three times and after every crash it got restarted and made backup. So three back ups are made in my solution folder... when I got the above mentioned error I moved all the backups from solution but i cant get rid of it....

Thank you;

Problem adding a Service Reference


Hello all.

I am developing a Web Application using Visual Studio 2010 in witch I have to add a Service Reference to http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc?wsdl.

The problem is that my company's network requires a proxy authentication. So when I enter the "Add Service Reference" dialog, paste the url and click "go" I get a "(407) Proxy Authentication Required" error and cannot add the service.

I also tried using svcutil but the result, obviously, was the same.

How can I work around this? Is there somewhere I can specify the required proxy? Googling around, I found some comments that it can be specified in the Web.config, but I can't find more details on how to do this.

Thanks in advance.

Asp.Net Routing Css And Javascript Reference Problem


Hi All!

I have problem with url routing. I'm using Asp.Net theme in my project. My theme is messing up. I couldn't figure out how could i ignore the css and js files.

Web.Config theme reference;

<pages theme="Default" styleSheetTheme="Default" ></pages>

I've tried;


routes.RouteExistingFiles = false;//assume routes as my routecollection

and this;

            routes.Ignore("{*alljs}", new { alljs= @".*\.js(/.*)?" });
            routes.Ignore("{*allcss}", new { allcss= @".*\.css(/.*)?" });

and this;


but still doesn't work. Some of my friends told me to use ResolveClientUrl but i can't figure out how to reference it(because asp.net theme writes it for me already).

I need help. Thanks.

p.s sorry for my bad english

Problem with assembly reference not updating


I have a solution A which references an assembly in solution B. I added the reference to the project in A by right clicking on the project > add reference, and finding the dll in the bin/Debug folder of the project in solution B in the Browse tab.
However, the reference to assembly B is not being updated in solution when I update the code in project B, even though I am making sure that I recompile the code in project B and then in project A. This means I am unable to debug A properly because the source code does not match the executable (I've checked and the location of the file the breakpoint is added to is correct).
I can go into the bin/Debug folder in project B, the date modified fields for the dll and .pdb files in

Outlook - "connect to SharePoint" and possible problem with irish names


Hi all,

I encountered a problem with the calendar page

<start problem>

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; InfoPath.3; MS-RTC LM 8)
Timestamp: Fri, 1 Oct 2010 09:14:18 UTC

Message: Expected '}'
Line: 1075
Char: 499
Code: 0
URI: .......

</end problem>

This results in the ribbon not being displayed i.e. the user doesn't have access to settings/connect to outlook etc. the user also does not have access to "+add item" and therefore cannot add calendar entries.

this error appears when I log in with an Irish user name . you may be familiar that Irish names contain "O' " e.g. O'Brien or O'Neill

when I log in as another user name without apostrophes I don't receive this error.

A possible workaround is to "connect to outlook" in reverse. is it possible to "connect to sharepoint" from Outlook ?

I know it is possible to connect to SharePoint from the backstage in

Problem while Adding reference of my Wcf Service



I have my wcf service hosted in the iis of the my development server.I am able to directly access the url of the service from both the server and the client browsers.I am also able to see the wsdl generated.

But when i add service reference from Visual studio 2008/2010,i get the following error..

The document at the url http://something.svc was not recognized as a known document type.

The error message from each known type may help you fix the problem:

- Report from 'http://something.svc' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from 'DISCO Document' is 'There was an error downloading 'http://something.svc?disco'.'.

 - The request failed with HTTP status 503: Service Unavailable.

- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

Metadata contains a reference that cannot be resolved: 'http://something.svc'.

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.

The remote server returned an error: (401) Unauthorized.

If the service is defined in the current 

Problem adding service reference to web services in VS 08



I’ve been trying to write some C# in Visual Studio 2008 to leverage SharePoint Web Services. I’ve scoured the web for help on this problem. I’m just beginning to learn .NET programming, but I’ve done a bunch with SharePoint Web Services with javascript and then with jQuery.SPServices.


If I start a new Console Application project and try to add a Service Reference, I put in my url: …/_vti_bin/Authentication.asmx and try to attach it. It tells me that there’s a problem with the certificate (which I get in the browser and SP Designer).


I get this error:

The HTML document does not contain Web service discovery information.
Metadata contains a reference that cannot be resolved: 'https://example.com/myCollection/_vti_bin/Authentication.asmx'.
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic Realm="example.com"'.
The remote server returned an error: (401) Unauthorized.
If the service is defined in the current solution, try building the solution and adding the service reference again.

If I click Advanced and Add Web Reference, I try again. This time, the browser window brings up the form we use to authenticate. From what I understand about the architecture, the MOSS

Problem in Web form app with reference to system.web



System: VS.NET 2010 Professional on Windows 7, targeting framework 4.0

I am developing a Win Forms app. Within my company another developer (he has now left his position) has developed a NET- component with some nice features I would like to use. The component has some references to System.Web. When I add a reference to the component Compax, I get Intellisense in VS.NET for writing

using Compax.Framework.DataAccess

But as soon as I try to compile I get two errors:
The type or namespace name 'Compax' could not be found (are you missing a using directive or an assembly reference?)

The other one reveals a bit more:

Warning    1    The referenced assembly "Compax.Framework, Version=1.1.10908.1, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has a dependency on "System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.   

So I try to add a reference to System.Web. But it is not in the list, probably since the current project is a win forms app. I can find the System.Web.dll by browsin

A better way to reference your wizard steps using named steps

Note: this article uses the plain vanilla but the concepts apply equally well to its popular counterpart .

By far the most common way that I see wizard steps reference in code snippets is by their index.

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Regrading Sharpoint 2010 problem and solutions

We can write your question and problem on this blogger.you get ans.use.

This sharpoint 2010 problem solving threads

Hi friend,

you can use this thread to solving problem and solutions.

Virtual Path Problem


 I get the following error on last line below (working on remote host): 'E:\web\sfcascom\ls_admin/uploads/images/001.JPG' is not a valid virtual path,

Note that the slashes go in different directions

I've tried a number of things but nothing seems to work. Thanks-


Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Web.UI.WebControls

Imports System.Drawing.Imaging.ImageCodecInfo
Partial Class Protected_imageupload
    Inherits System.Web.UI.Page
    Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
        ' Initialize variables
        Dim sSavePath As String
        Dim sThumbExtension As String
        Dim intThumbWidth As Integer
        Dim intThumbHeight As Integer
        Dim sFilename As String = ""
        ' Set constant values
        'sSavePath = "images/"
        sSavePath = Server.MapPath("~/") + "ls_admin/uploads/images/"

        sThumbExtension = "_thumb"
        intThumbWidth = 160
        intThumbHeight = 120

        ' If file field isn?t empty
        If FilUpload.PostedFile IsNot Nothing Then
            ' Check file size (mustn?t be 0)
            Dim myFile As Http

Strange Photo upload problem


I'm working project it's live on shared hosting

we'er uploading photos to a file on the server everything works fine the photo is resized renamed and sent to the folder

the upload page returns the thumbnail and the full size photo it's there all the photos have to be approved by an admin

twice now after they have been approved they disapear I checked the folder they are not there could there be anywhere

on the server they could get hung up before they go into the folder I have it setup so when you delete the data base entry it deletes the photo from the folder othe than that you need to open the folder and delete the photo this has hapened twice now I tried to recreate it with no luck

thaks for your help in advance

ASP.Net Caching problem ??


I'm having a problem with an asp.net 3.0 application using a gridview to display data.  The problem seems to be that despite a brand new .selectCommand being sent to the sqlDataSource, the gridview starts displaying data from *someone else's* query.  For example, user A is logged in and will be working fine until a few page submissions later when the gridview data starts suddenly showing information that belongs to another user. 

This is my first asp.net application, though I've been working with classic asp and ADO for years so I'm used to sending a SQL string and getting back the results from that string.  Apparently there is a complex caching system which is interferring which I do not at all understand so at this point I just want to stop the server from caching any data whatsoever.  Is this possible?

Any and all help will be much appreciated!!

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend