473,466 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

System.UnauthorizedAccessException: Access is denied.

Hi,

I'm trying to use the Office PIA to access MSGraph.
I've placed Microsoft.Office.Interop.Graph.dll in with my C# code and added
it as a reference to the project.

The code compiles, (although what is will do yet???) but when run I am
presented with an Unauthorized Access Exception.

Do I need to give the ASPNET user account access to create the MSGraph COM
object. If so how, does this require DComCnfg??

Below is my code.

Any help or advice greatly appreciated!

TIA

MattC

using System.Runtime.InteropServices;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;

MSGraph.Application g = new MSGraph.GlobalClass().Application;
MSGraph.Chart c = g.Chart();
c.ChartArea.Font.Size = 8;
c.Application.Update();
c.ChartType = MSGraph.XlChartType.xl3DBarClustered;
c.HasTitle = true;
c.ChartTitle.Caption = "This is a Test";
c.ChartTitle.Font.Size = 12;
MSGraph.DataSheet ds = g.Application.DataSheet;
ds.Cells.Clear();
ds.Cells[2, 1] = "Widgets";
ds.Cells[3, 1] = "Gadgets";
ds.Cells[4, 1] = "Gizmos";
ds.Cells[1, 2] = "1999";
ds.Cells[1, 3] = "2000";
int row;
int col;
Random r = new Random();
for(row = 2; row <= 4; row++)
for(col = 2; col <= 3; col++)
ds.Cells[row, col] = r.Next(100000);
g.Application.Update(); //Update the changes
g.Application.Quit(); //and deactivate the chart.
Jan 20 '06 #1
0 1797

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Efi | last post by:
Hi, We have a simple 3 tier application which its core application is VC++ 6.0 ATL COM running as a server application in the COM+. An asp pipe is in charge of handling the requests and passes it...
0
by: masago | last post by:
Hi....how are you ?? they can help me to solve this problem ?? Access to the path = "c:\windows\microsoft.net\framework\v1.1.4322\Temporary ASP.NET = Files\reports\06639073\bbab30a7" is...
5
by: Max | last post by:
hi i have file browser control to select any file and a button to upload file on my web page now when i select any file. now on click of upload button i have check that file exist or no if...
4
by: Max | last post by:
hi i have file browser control to select any file and a button to upload file on my web page now when i select any file. now on click of upload button i have check that file exist or no if...
2
by: job | last post by:
In a sharepoint setup using smartpart to load our user controls using enterprise blocks (data) we are getting some strange errors (logged to the event log). We dont get the error all the time. When...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.