Attachments.Add COMException HRESULT: 0x80004004 (E_ABORT)

I overrode the Outlook attach file button by my ribbon command:
<commands>
<command idMso="AttachFile" onAction="onAttachFile" />
</commands>
In the ribbon class I implemented the prompt to use my own attach file logic or default. I didn't found how to call default dialog using. So I added my own dialog:
public void onAttachFile(Office.IRibbonControl control, bool pressed)
var item = control.Context as Outlook.Inspector;
var mailItem = item.CurrentItem as Outlook.MailItem;
MessageBoxResult messageBoxResult = MessageBox.Show("Do you wish to use cusom logic to send files?", "Prompt", MessageBoxButton.YesNo);
if (messageBoxResult == MessageBoxResult.No)
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.ValidateNames = false;
dlg.CheckFileExists = false;
dlg.CheckPathExists = true;
dlg.Filter = "All files|*.*";
dlg.Multiselect = true;
Nullable<bool> result = dlg.ShowDialog();
if (result == true)
foreach (var fileName in dlg.FileNames)
mailItem.Attachments.Add(fileName,Outlook.OlAttachmentType.olByValue, 1, fileName);
Execuring this code I get for MailItem.Attachments.Add() line COMException HRESULT: 0x80004004 (E_ABORT).
Thanks in advance for any ideas!

Hello,
The repurposed callback should look like the following one:
C#: void OnAction(IRibbonControl control, ref bool CancelDefault)
VBA: Sub OnAction(control As IRibbonControl, byRef CancelDefault)
C++: HRESULT OnAction([in] IRibbonControl *pControl, [in,out] VARIANT _BOOL *fCancelDefault)
Visual Basic: Sub OnAction(control As IRibbonControl, byRef CancelDefault)
The CancelDefault parameter allows to suppress the default action, you just need to set it to true. If you need to keep the default action running then you'd need to keep set to false.
Also I'd suggest avoiding any message boxes in the repurposed callbacks. If you do so, you need to implement all the required functionality in your code without relying to the built-in actions. Any dialog windows shown in the repurposed callbacks prevent
default actions from running.  
You can read more about that in the Temporarily Repurpose Commands on the Office Fluent Ribbon article in MSDN.

Similar Messages

  • Add attachments to List Item using JavaScript Client object model in SP2010

    Hi All ,
    I have created custom form for submitng data in list using javascript client object model/jquery .
    Now I want to add option to uplaod multiple attachments to that list item also .
    Is there option with client object model for uplaoding attachment.
    Thanks
    M
    Manesh G

    Can you try this and let me know
    using (SPSite _site = new SPSite(SPContext.Current.Site.Url))
        using (SPWeb _web = _site.OpenWeb())
         //Let's suppose your Item Id is 1
         int ItemId = 1;
         SPList  oList = _web.Lists["EmployeeList"];
         SPListItem  _item = oList.GetItemById(ItemId);
         if (FileUpload1.HasFile)
               _web.AllowUnsafeUpdates = true;
              Stream fs = FileUpload1.PostedFile.InputStream;
              byte[] _bytes = new byte[fs.Length];
              fs.Position= 0;
              fs.Read(_bytes, 0, (int)fs.Length);
              fs.Close();
              fs.Dispose();
              _item.Attachments.Add(FileUpload1.PostedFile.FileName, _bytes);
              _item.Update();
              _web.AllowUnsafeUpdates = false;

  • Add SharePoint List attachments to Multiple List Items

    I have a SharePoint list with around 7000 items.  What is the simplest way to add attachment to each list items? I'm thinking of Edit in Datasheet but of no luck..
    cal_bonjovi

    hi,
    you can do this with the below powershell
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    function AddAttachment($item, $filePath)
    $bytes = [System.IO.File]::ReadAllBytes($filePath)
    $item.Attachments.Add([System.IO.Path]::GetFileName($filePath), $bytes)
    $item.Update()
    $site = [Microsoft.SharePoint.SPSite]("http://myserver")
    $web = $site.OpenWeb()
    $list = $web.Lists["MyList"]
    foreach ($listItem in $list.Items)
    AddAttachment $listItem"c:\z.txt"
    Whenever you see a reply and if you think is helpful,Vote As Helpful! And whenever you see a reply being an answer to the question of the thread, click Mark As Answer

  • Office Interop 32 bit on 64 bit OS email attachments filling up outlook temp folder OLK

    I have an issue when sending emails (many) using Office.Interop 32 bit that when the application is installed on a 64 bit OS the outlook secure temp is filling up and throwing an exception, this does not occur when the application is installed on a 32 bit
    OS.
    .NET framework 4.0
    Visual Studio 2010 (C#)
    Microsoft.Office.Interop.Outlook 14.0.0.0 Runtime v2.0.50727
    for (int i = 0; i < 300; i++)
    Microsoft.Office.Interop.Outlook.Application outlookApplication = new Microsoft.Office.Interop.Outlook.Application();
    Microsoft.Office.Interop.Outlook._MailItem oMailItem = (Microsoft.Office.Interop.Outlook._MailItem)outlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
    oMailItem.Recipients.Add("[email protected]").Type = 1;
    oMailItem.Subject = "test email";
    oMailItem.BodyFormat = OlBodyFormat.olFormatHTML;
    oMailItem.Save();
    oMailItem.Attachments.Add(@"C:\test_doc_1.docx", (int)Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, Type.Missing, Type.Missing);
    oMailItem.Attachments.Add(@"C:\test_doc_2.docx", (int)Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, Type.Missing, Type.Missing);
    oMailItem.Send();
    Win7 32bit with Outlook 2010 32bit -> Works on this setup
    Win7 64bit with Outlook 2010 32bit -> Does not work on this set up
    Problem:
    Sending many emails with the same attachment fills the outlook secure temp folder 
    C:\Users\[User]\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook\ZT7WMFGK\
    (with a temp copy of the attachment) these files are not removed on Win7 64bit so at about 200 emails the exception is thrown:
    "Cannot create file [file name]. Right-click the folder you want to create the file in, and then click Properties on the shortcut menu to check your permissions for the folder."
    On Win7 32bit i can see the files getting automatically deleted from the secure temp folder so there is no problem
    Im not sure where to start with this.

    Seems that you have to release the objects explicitly. According to articles (http://www.bing.com/search?q=c%23%20release%20com%20objects), try this:
    Application outlookApplication =
    new
    Application();
    _MailItem oMailItem = (_MailItem)outlookApplication.CreateItem(
    OlItemType.olMailItem );
    var recipients = oMailItem.Recipients;
    var recipient = recipients.Add(
    recipient.Type =
    1;
    oMailItem.Subject =
    "test email";
    oMailItem.BodyFormat =
    OlBodyFormat.olFormatHTML;
    oMailItem.Save();
    var attachments = oMailItem.Attachments;
    var attachment1 = attachments.Add(
    @". . . .", (int)OlAttachmentType.olByValue,
    Type.Missing,
    Type.Missing );
    var attachment2 = attachments.Add(
    @". . . .", (int)OlAttachmentType.olByValue,
    Type.Missing,
    Type.Missing );
    oMailItem.Send();
    Marshal.ReleaseComObject( attachment2
    Marshal.ReleaseComObject( attachment1
    Marshal.ReleaseComObject( attachments
    Marshal.ReleaseComObject( recipient );
    Marshal.ReleaseComObject( recipients
    Marshal.ReleaseComObject( oMailItem );
    Marshal.ReleaseComObject( outlookApplication
    Check (with Debugger) that the files are removed at the end of this fragment.
    Also consider creating a single outlookApplication before the loop.

  • Attachments help - C# using Obect API

    I'm in my first attempt at integrating GW functionality into a C# application. I am not an expert C# programmer either. Thus far I've been successful at getting logged into GW, creating a new mail message and sending it successfully. However adding code to attach a file to my message returns an exception from the GroupwareTypeLibrary with the unhelpful error message "Unknown Error". Below is my code. If I comment out the line:
    objMessage.Attachments.Add("c:\reg.log",1,"reg.log ");
    the program runs successfully, happily sending my mail to the recipent mailbox. I know the c:\reg.log file exists and I have permissions to it.
    Any advice as to what I'm doing wrong would be of tremendous help, as I've already search and cruised all the forums on GW API I can find to no avail. Running GW 7.03 I think on client and server side.
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.IO;
    using GroupwareTypeLibrary;
    namespace GWEmailTest
    class Program
    public static void Main()
    GroupwareTypeLibrary.Application objApplication = new GroupwareTypeLibrary.Application();
    GroupwareTypeLibrary.Account objAccount;
    GroupwareTypeLibrary.Messages objMessages;
    GroupwareTypeLibrary.Message objMessage;
    GroupwareTypeLibrary.Folder objMailBox;
    GroupwareTypeLibrary.Recipients objRecipients;
    GroupwareTypeLibrary.Recipient objRecipient;
    objAccount = objApplication.Login("dpuls", "", "password", "", "");
    objMailBox = objAccount.MailBox;
    objMessages = objMailBox.Messages;
    objMessage = objMessages.Add("GroupwareTypeLibrary.Message",4," ");
    objRecipients = objMessage.Recipients;
    objRecipient = objRecipients.Add("dpuls","","");
    objMessage.Subject.PlainText = "Here's the message from C#!.";
    objMessage.BodyText.PlainText = "Here's the report you wanted.";
    objMessage.Attachments.Add("c:\reg.log",1,"reg.log ");
    objMessage.Send();

    Markus,
    Thanks so much for your quick reply. I appreciate your willingness to help me overcome my ignorance. Here's what I found:
    objMessage = objMessages.Add("GW.MESSAGE.MAIL", 4);
    results in a C# compiler error "no overload method for 'add' requires '2' arguments". This tells me the third paramater is required for the GroupwareTypeLibary COM object, so I added the third null parameter back in, eliminating the compiler error. Then I still got the same "unknown error" exception back from the COM library as before.
    So I went back to my shotgun approach of trying variations on parameter passing (instance variables instead of literals, etc). I noticed at one point when I tried another test file that I got a compiler error on a string literal of the path\filename "c:\csharptest.txt". Aha, says I ......
    To make a long story short, by happenstance, my "c:\reg.log" parameter gets read in C# as containing an escape sequence reference, i.e. "\r" and when I changed to another test file it read "c:\csharptest.txt" as an INVALID escape sequence "\c". The fix then was to correct the problem of the reading of escape sequences in my string literal by changing my line of code to :
    objMessage.Attachments.Add(@"c:\reg.log","1","");
    Problem solved! Thanks again for your help.
    dennis puls
    Originally Posted by Markus Colorado
    I suppose the way you're adding a draft message to the collection is false.
    >> objMessages = objMailBox.Messages;
    >> objMessage = objMessages.Add("GroupwareTypeLibrary.Message",4," ");
    The function "Add()" takes only 2 parameters, 'ClassName' + 'ObjType'.
    'ClassName' stands for the sort/subtype of message you'd like to create.
    'ObjType' stands for 'draft' or 'personal'
    Try the following:
    objMessages = objMailBox.Messages;
    objMessage = objMessages.Add("GW.MESSAGE.MAIL", 4);
    The rest should be fine; the code for adding the attachment seems OK.
    Markus
    "dpuls" <[email protected]> schrieb im Newsbeitrag
    news:[email protected]...
    >
    > I'm in my first attempt at integrating GW functionality into a C#
    > application. I am not an expert C# programmer either. Thus far I've
    > been successful at getting logged into GW, creating a new mail message
    > and sending it successfully. However adding code to attach a file to my
    > message returns an exception from the GroupwareTypeLibrary with the
    > unhelpful error message "Unknown Error". Below is my code. If I
    > comment out the line:
    > objMessage.Attachments.Add("c:\reg.log",1,"reg.log ");
    >
    > the program runs successfully, happily sending my mail to the recipent
    > mailbox. I know the c:\reg.log file exists and I have permissions to
    > it.
    >
    > Any advice as to what I'm doing wrong would be of tremendous help, as
    > I've already search and cruised all the forums on GW API I can find to
    > no avail. Running GW 7.03 I think on client and server side.
    >
    > ****************************
    > using System;
    > using System.Collections.Generic;
    > using System.Text;
    > using System.IO;
    > using GroupwareTypeLibrary;
    >
    > namespace GWEmailTest
    > {
    > class Program
    > {
    > public static void Main()
    > {
    > GroupwareTypeLibrary.Application objApplication = new
    > GroupwareTypeLibrary.Application();
    > GroupwareTypeLibrary.Account objAccount;
    > GroupwareTypeLibrary.Messages objMessages;
    > GroupwareTypeLibrary.Message objMessage;
    > GroupwareTypeLibrary.Folder objMailBox;
    > GroupwareTypeLibrary.Recipients objRecipients;
    > GroupwareTypeLibrary.Recipient objRecipient;
    >
    > objAccount = objApplication.Login("dpuls", "", "password", "",
    > "");
    > objMailBox = objAccount.MailBox;
    > objMessages = objMailBox.Messages;
    > objMessage = objMessages.Add("GroupwareTypeLibrary.Message",4," ");
    > objRecipients = objMessage.Recipients;
    > objRecipient = objRecipients.Add("dpuls","","");
    > objMessage.Subject.PlainText = "Here's the message from C#!.";
    > objMessage.BodyText.PlainText = "Here's the report you wanted.";
    > objMessage.Attachments.Add("c:\reg.log",1,"reg.log ");
    > objMessage.Send();
    > }
    > }
    > }
    > ****************************
    >
    >
    > --
    > dpuls
    > ------------------------------------------------------------------------
    > dpuls's Profile: NOVELL FORUMS - View Profile: dpuls
    > View this thread: Attachments help - C# using Obect API - NOVELL FORUMS
    >

  • How to Add New Parameter in Cluster with LabVIEW Executable Program?

        In this VI,it can write the parameter in Cluster to the database (Access 2003).it run well.
        But When I add another parameter in Cluster,such as EE,I have to modify this Cluster. And at the same time,I have to modiy the database (I should add a column of EE).if this vi build to exe, how can I achieve it?Can LabVIEW have any way to increase new parameter EE in Cluster and in Database in executable program?
        Would you give me some advice?Thank you
    Attachments:
    Add ParaMeter In Cluster 20130206.zip ‏105 KB
    Cluster.JPG ‏9 KB

    It's rather unclear what you try to do here. In your first post you talk IMHO about the high level Datatbase Toolkit functions that take a cluster and translate it automagically into the appropriate SQL Query/Update.
    Your second question seems to be about the user interface of your application.
    Proper application design would mean to separate the user interface aspect from the actual database query in some ways. I definitely wouldn't use the same cluster for both. Also if you simply hide a control on the frontpanel (possible also in an executable) it still is present logically and if you end up using the high level database toolkit functions with that cluster it will result into a query or update of the database with all the data in the cluster, also the hidden ones.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How do I add a constant into a DAQMX Graph

    Using the example VI "Continious Acquisition Thermocouple Samples Internal Clock" in DAQMX Base how do I add a constant onto the waveform chart that is displaying the thermocouple reading ? What I really want are upper and lower limit constants that are displayed on the graph.
    Thanks

    Assuming that you're getting an array of waveform data types back from the DAQ board, you just have to append a couple of waveforms with the same number of samples and a fixed value. I modified an example that uses DAQmx but I think the DAQmx base example should be similar. Change the constants to the upper and lower levels that you want or replace the constants with front panel controls.
    Attachments:
    Add constants.JPG ‏35 KB

  • Add attachment to email - DIAPI

    Hi all,
    I'm programming in C++ and I can't send email with attachment using DIAPI.
    I have registered the file to be attached in SAP using yhe object Attachments2 and when I create the message I put the id that identify the file I want to attach.
    On SAP if I watch the sent message, I found the message sent as email with the attachment (and I'm able also to see the attachment), but on outlook I can't see any attachment.
    In the OALR table the attachment entry is set correctly but no attachment path is shown.
    Any ideas?
    Thanks,
    gabriele

    Hi Gabriele,
    There is a SAP note about using this attachments2 object - note 1308979:
    In order to add attachments using the Attachments2 object, two steps are
    required:                                                                               
    1.  Add the attachment to Business One                                                                               
    2.  Link this attachment to the required document.                                                                               
    The following example adds the file "10011.doc" stored on the system   
    under "C:\Test" to the existing Activity 13 in SAP Business One.                                                                               
    Dim oAtt As SAPbobsCOM.Attachments2                                
        oAtt = oCompany.GetBusinessObject(oAttachments2)                   
        oAtt.Lines.SourcePath = "C:\Test"                                  
        oAtt.Lines.FileName = "10011"                                      
        oAtt.Lines.FileExtension = "doc"                                   
        oReturn = oAtt.Add()
    You have now added the document to Business One. Next you have to link 
    this attachment to the Activity by setting the AttachmentEntry value of
    the Activity to the value of the AbsoluteEntry of the newly added      
    attachment:                                                                               
    If (oContact.GetByKey(13)) Then                                        
        test = oContact.CardCode                                           
        oContact.AttachmentEntry = oAtt.AbsoluteEntry                      
        oContact.Attachments.Add                                           
        oReturn = oContact.Update()
    End If
    The above example is for an activity, but the process is the same for all objects which can take attachments.
    If you are following this process but the attachments are still not included in Outlook, I would advise contacting support to look into this issue.
    Regards,
    Niall

  • How do I avoid .bin attachments with SmtpClient.Send(MailMessage)?

    I'm hitting the problem
    described here. However, I don't see any way with MailMessage to set the ordering of the content of the email.
    How can I fix this?
    MailMessage mail = new MailMessage(new MailAddress(emailTempKeysFrom, "Windward Studios"), new MailAddress(to[0], pur.Account.Name));
    mail.Body = txt;
    AlternateView htmlView = AlternateView.CreateAlternateViewFromString(html, null, MediaTypeNames.Text.Html);
    int num = 0;
    foreach (MemoryStream mem in imagesTempKeys)
    mem.Position = 0;
    LinkedResource res = new LinkedResource(mem);
    res.ContentId = "image" + num;
    res.TransferEncoding = TransferEncoding.Base64;
    htmlView.LinkedResources.Add(res);
    num++;
    mail.AlternateViews.Add(htmlView);
    mailObj.Send(mail);
    thanks - dave
    What we did for the last 6 months -
    Made the world's coolest reporting & docgen system even more amazing

    Hello,
    Not sure if you have already seen this
    ContentDisposition Class, with it, sending a CSV file by using stmpclient, I can received the file with the correct format in the Outlook:
    static void Main(string[] args)
    try
    SmtpClient client = new SmtpClient();
    client.Credentials = new System.Net.NetworkCredential(usename,password);
    client.EnableSsl = true;
    client.Port = 587; // Gmail works on this port
    client.Host = "smtp.gmail.com";
    MailAddress from = new MailAddress(from)
    // Set destinations for the e-mail message.
    MailAddress to = new MailAddress(to);
    // Specify the message content.
    MailMessage message = new MailMessage(from, to);
    message.Body = "This is a test e-mail message sent by an application. ";
    // Include some non-ASCII characters in body and subject.
    string someArrows = new string(new char[] { '\u2190', '\u2191', '\u2192', '\u2193' });
    message.Body += Environment.NewLine + someArrows;
    message.BodyEncoding = System.Text.Encoding.UTF8;
    message.Subject = "test message 1" + someArrows;
    message.SubjectEncoding = System.Text.Encoding.UTF8;
    string file = "Sample20150126.csv";
    // Create the file attachment for this e-mail message.
    Attachment data = new Attachment(file, MediaTypeNames.Application.Octet);
    // Add time stamp information for the file.
    ContentDisposition disposition = data.ContentDisposition;
    disposition.CreationDate = System.IO.File.GetCreationTime(file);
    disposition.ModificationDate = System.IO.File.GetLastWriteTime(file);
    disposition.ReadDate = System.IO.File.GetLastAccessTime(file);
    // Add the file attachment to this e-mail message.
    message.Attachments.Add(data);
    // Set the method that is called back when the send operation ends.
    client.SendCompleted += new
    SendCompletedEventHandler(SendCompletedCallback);
    // The userState can be any object that allows your callback
    // method to identify this send operation.
    // For this example, the userToken is a string constant.
    string userState = "test message1";
    client.SendAsync(message, userState);
    Console.WriteLine("Sending message... press c to cancel mail. Press any other key to exit.");
    string answer = Console.ReadLine();
    // If the user canceled the send, and mail hasn't been sent yet,
    // then cancel the pending operation.
    if (answer.StartsWith("c") && mailSent == false)
    client.SendAsyncCancel();
    // Clean up.
    message.Dispose();
    Console.WriteLine("Goodbye.");
    catch (Exception e)
    Console.WriteLine(e);
    private static void SendCompletedCallback(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
    mailSent = true;
    Console.WriteLine("Sent");
    Please have a try and if this does not work, please feel free to let me know.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to uninstall NI drivers that are not removable via "Add/Remove Programs"?

    Hi,
    I am trying to uninstall older versions of NI MAX and DAQ drivers via "Add/Remove Programs" in Control Panels on a Win2000 test PC, but nothing happen when the "Remove" button is pressed. The same issue does not happen with any other drivers or applications installed on the same test PC. These two drivers might have been installed improperly before. Please advise how I can uninstall them without using "Add/Remove Programs"? Thank you very much for your help.
    Valen

    Hello LA,
    The window that I have is different from the one you posted. Please see attached for mine. When I clicked on REMOVE, a message popped up and disappeared within a couple seconds. And the message is as following: "The installer is verifying the installation, please do not reboot while this dialog is being display." This same message popped up every time REMOVE is clicked but I have no luck on removing MAX.
    This test PC is for legacy testing and it was with Windows 98 and have an ISA DAQ card installed that requires DAQ driver 6.9.3. Can upgrading the test PC to Windows 2000 corrupt the installation?
    Looking forward for your advice. Thank you.
    Valen
    Attachments:
    Add Remove Programs.doc ‏57 KB

  • How to add integer value of two buttons?

    how to add integer value of two buttons (any button) in VI and display it in output text box? i have attached example program, but i know its wrong.. please help
    Solved!
    Go to Solution.
    Attachments:
    add.vi ‏8 KB

    thanks for reply. i am trying to assign an integer value to a button and the button should send the assigned integer value to TCP/IP write, only when the button is pressed. i am able to send data using string control (as shown in the attachment) but i want to replace it with several buttons. for example, if i enter 2 in string control, this data will be sent to a robot (robot has wifi card)  through tcp/ip protocol, it moves front. 3 will make it to move back, 8 is left, 6 is right. this numeric data is already burnt into blackfin processor of the robot. so just by entering numbers in labview can make my robot move in specified direction. can you please help me to create a button with value and convert it into string and send it to tcp/ip write. this should happen only when the button is pressed. because, if i enter numbers in string control, it dosent looks good..... if i have buttons... i think my VI will look good and hitech.
    Attachments:
    robo.vi ‏9 KB

  • Add limits to step settings via TestStand API from LabVIEW

    Dear LabVIEW and TestStand Community!
    I'm trying to add FileGlobal Variables as limits to TestStand step NumericLimit programmatically, via LabVIEW, via TS API. I attach screenshot of the code, which I use (part of it - the module, which only sets values to low and high limit of the step), and also I attach, what I manage to get.
    In TS, when I open sequence file, after running of the code, I can see in the description line of the test, that it accepted limits, which I set from LV - you can see it from the screenshot, it is marked with yellow. But in the Tab "Limits", there are still default numeric values, not FileGlobal Variables.
    Could anyone explain, what doest it mean, and how to set up them correctly?
    Thanks a lot in advance!
    Solved!
    Go to Solution.
    Attachments:
    Limits.PNG ‏33 KB
    Add Limits.PNG ‏15 KB

    It's kind of sequence generator what I'm doing now...
    Thank you very much for fast reply, but when I setup "UsexxxExpr" to true, it doesn't change the situation... Could you, please, check my attachment? Maybe, some mistake in syntax?
    Attachments:
    Add Limits.PNG ‏23 KB

  • Adding Attachments in Mail, is it awful or am I do something wrong?

    I just switched over to Mail from MS Entourage 2004. When I go to add an attachment in the email, even though I have the preference in the Edit/Attachments/Add Attachment at the End of the Email selected, it sometimes splits the message I wrote when I drag and drop the attachment into the email.
    Entourage provided a little box just below the address block where you could drop the attachment in, that was so much better. Is there something I am doing wrong here, or this just the way it is?

    So, I figured it out.
    Sometimes I want the exact opposite order than is (reliably) possible given the table sort algorithm.
    If, in a table sort function, one replaces:
    return order
    with
    return not order
    (in a perfectly working sort function), it reverses the order of the sort but may not handle the last element properly.
    The reason is this:
    The table sort return value is determining whether to swap two values or not to swap them, it is *not* determining absolute ordering - if it were, then returning true would mean order one way, and returning false would mean order the opposite way.
    Enough talk - test plugin: http://www.robcole.com/_temp/TestLrPlugins/Scratch_LrPlugin_0.0.zip
    (Instructions: In plugin manager, click 'Local Test' button. Source code is in ExtendedManager.lua (tableSortTest function) and Framework/Data/Table.lua (reverseSortCopy method).
    Rob

  • SharePoint 2013 audit log unexpected error

    In one of my SharePoint 2013 site collection, when i try to save a audit log,  i get unexpected error. It worked fine before last week and no any special setting has been applied before the issue appeared. The issue doesn't appear in other site collection.
    i have tried to reproduce the issue with farm admin account and site collection admin, no success for all these accounts. However, i can see access denied error in the ULS log although i think the permission is not the problem. You may check the ULS log below. 
    06/19/2014 10:48:09.41 w3wp.exe (0x77C0)
    0x2918 0xC33B005
    2jtj Assert
    ShipAssert location: (0)  condition:   StackTrace:  at onetnative.dll: (sig=7b7c0170-6822-4da2-8b1b-70510b777a4a|2|onetnative.pdb, offset=12700) at onetnative.dll: (offset=125F1)
    ea429c9c-4288-00dd-4f6f-d2bb079f3d44
    06/19/2014 10:48:09.41 w3wp.exe (0x77C0)
    0x2918 SharePoint Foundation
    Unified Logging Service c91s
    Monitorable Watson bucket parameters: Microsoft SharePoint Foundation 4, ULSShipAssert12, 2jtj, 15.0.4481.0
    ea429c9c-4288-00dd-4f6f-d2bb079f3d44
    06/19/2014 10:48:09.41 w3wp.exe (0x77C0)
    0x2918 0xEB2D00B
    2jtk High
    Metro library failure (0x80070005): ea429c9c-4288-00dd-4f6f-d2bb079f3d44
    06/19/2014 10:48:09.41 w3wp.exe (0x77C0)
    0x2918 0xEB2D00B
    2jtq High
    Metro library failure (0x80070005): ea429c9c-4288-00dd-4f6f-d2bb079f3d44
    06/19/2014 10:48:09.41 w3wp.exe (0x77C0)
    0x2918 0xEB2D005
    2jx8 High
    Metro library failure (0x80070005): ea429c9c-4288-00dd-4f6f-d2bb079f3d44
    06/19/2014 10:48:09.41 w3wp.exe (0x77C0)
    0x2918 0xEB2D005
    5s03 High
    Metro library failure (0x80070005): ea429c9c-4288-00dd-4f6f-d2bb079f3d44
    06/19/2014 10:48:09.41 w3wp.exe (0x77C0)
    0x2918 0xEB2D005
    5s02 High
    Metro library failure (0x80070005): ea429c9c-4288-00dd-4f6f-d2bb079f3d44
    06/19/2014 10:48:09.41 w3wp.exe (0x77C0)
    0x2918 0xEB2D005
    2jw0 High
    Metro library failure (0x80070005): ea429c9c-4288-00dd-4f6f-d2bb079f3d44
    06/19/2014 10:48:09.43 w3wp.exe (0x77C0)
    0x2918 SharePoint Foundation
    Database ahjqp
    High [Forced due to logging gap, cached @ 06/19/2014 10:48:07.68, Original Level: Verbose] SQL connection time: 0.064296296654057
    ea429c9c-4288-00dd-4f6f-d2bb079f3d44
    06/19/2014 10:48:09.43 w3wp.exe (0x77C0)
    0x2918 SharePoint Foundation
    General 8nca
    Medium Application error when access /_layouts/15/CustomizeReport.aspx, Error=拒绝访问。 (异常来自 HRESULT:0x80030005 (STG_E_ACCESSDENIED))   在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
    errorCode, IntPtr errorInfo)     在 Microsoft.Office.Server.OpenXml.Internal.ByteStream.Write(Byte[] rgb, Int32 offset, Int32 cb)     在 System.IO.BufferedStream.FlushWrite()     在 System.IO.StreamWriter.Dispose(Boolean disposing)
        在 System.IO.StreamWriter.Close()     在 System.Xml.XmlTextWriter.Close()     在 Microsoft.Office.RecordsManagement.Reporting.AuditReportGenerator.Dispose()     在 Microsoft.Office.RecordsManagement.Reporting.ReportData.Dispose()
        在 Microsoft.Office.RecordsManagement.Reporting.ReportBase.AggregateReports(Hashtable query, SPFolder folder, ReportNameGenerator reportNameGenerator)     在 Microsoft.Office.RecordsManagement.Reporting.ApplicationPages.CustomizeReport.OKBtn_Click(Object
    sender, EventArgs e)     在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    ea429c9c-4288-00dd-4f6f-d2bb079f3d44
    06/19/2014 10:48:09.44 w3wp.exe (0x77C0)
    0x2918 SharePoint Foundation
    Runtime tkau
    Unexpected System.Runtime.InteropServices.COMException: 拒绝访问。 (异常来自 HRESULT:0x80030005 (STG_E_ACCESSDENIED))    在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr
    errorInfo)     在 Microsoft.Office.Server.OpenXml.Internal.ByteStream.Write(Byte[] rgb, Int32 offset, Int32 cb)     在 System.IO.BufferedStream.FlushWrite()     在 System.IO.StreamWriter.Dispose(Boolean disposing)     在
    System.IO.StreamWriter.Close()     在 System.Xml.XmlTextWriter.Close()     在 Microsoft.Office.RecordsManagement.Reporting.AuditReportGenerator.Dispose()     在 Microsoft.Office.RecordsManagement.Reporting.ReportData.Dispose()  
      在 Microsoft.Office.RecordsManagement.Reporting.ReportBase.AggregateReports(Hashtable query, SPFolder folder, ReportNameGenerator reportNameGenerator)     在 Microsoft.Office.RecordsManagement.Reporting.ApplicationPages.CustomizeReport.OKBtn_Click(Object
    sender, EventArgs e)     在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    ea429c9c-4288-00dd-4f6f-d2bb079f3d44
    06/19/2014 10:48:09.44 w3wp.exe (0x77C0)
    0x2918 SharePoint Foundation
    General ajlz0
    High Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): 引发类型为“System.Web.HttpUnhandledException”的异常。 ---> System.Runtime.InteropServices.COMException (0x80030005): 拒绝访问。 (异常来自 HRESULT:0x80030005
    (STG_E_ACCESSDENIED))     在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)     在 Microsoft.Office.Server.OpenXml.Internal.ByteStream.Write(Byte[] rgb, Int32 offset, Int32 cb)  
      在 System.IO.BufferedStream.FlushWrite()     在 System.IO.StreamWriter.Dispose(Boolean disposing)     在 System.IO.StreamWriter.Close()     在 System.Xml.XmlTextWriter.Close()     在 Microsoft.Office.RecordsManagement.Reporting.AuditReportGenerator.Dispose()
        在 Microsoft.Office.RecordsManagement.Reporting.ReportData.Dispose()     在 Microsoft.Office.RecordsManagement.Reporting.ReportBase.AggregateReports(Hashtable query, SPFolder folder, ReportNameGenerator reportNameGenerator)    
    在 Microsoft.Office.RecordsManagement.Reporting.ApplicationPages.CustomizeReport.OKBtn_Click(Object sender, EventArgs e)     在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     在 System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     在 System.Web.UI.Page.HandleError(Exception e)     在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
        在 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     在 System.Web.UI.Page.ProcessRequest()     在 System.Web.UI.Page.ProcessRequest(HttpContext context)  
      在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    ea429c9c-4288-00dd-4f6f-d2bb079f3d44

    i have added the account to the local admin group of SQL Server and SharePoint Server. the issue remains. it is the system admin of the SQL server. 
    Logging Correlation Data
    Medium
    Name=Request (POST:https://xxx/_layouts/15/CustomizeReport.aspx?ReportId=df9e0f20-f356-4115-9286-ac6eecbc03ce&Category=Auditing)
    Authentication Authorization
    Medium
    Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|tlw\farmadmin, ClaimsCount=28
    Logging Correlation Data
    Medium
    Site=/
    Information Rights Management
    Medium
    Information Rights Management (IRM): Requesting user is System account.
    Files
    High
    UserAgent not available, file operations may not be optimized.    在 Microsoft.SharePoint.SPFileStreamManager.CreateCobaltStreamContainer(SPFileStreamStore spfs, ILockBytes ilb, Boolean copyOnFirstWrite, Boolean
    disposeIlb)     在 Microsoft.SharePoint.SPFileStreamManager.SetInputLockBytes(SPFileInfo& fileInfo, SqlSession session, PrefetchResult prefetchResult)     在 Microsoft.SharePoint.CoordinatedStreamBuffer.SPCoordinatedStreamBufferFactory.CreateFromDocumentRowset(Guid
    databaseId, SqlSession session, SPFileStreamManager spfstm, Object[] metadataRow, SPRowset contentRowset, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres)     在 Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32
    rowOrd, Object ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres)     在 Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAndMetaInfo(String bstrUrl, Byte bPageView, Byte bPageMode, Byte bGetBuildDependencySet,
    String bstrCurrentFolderUrl, Int32 iRequestVersion, Byte bMainFileRequest, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean& pbGhostedDocument, Boolean& pbDefaultToPersonal, Boolean&
    pbIsWebWelcomePage, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion, String& pbstrTimeLastModified, String& pbstrContent, UInt32& pdwPartCount, Object& pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String&
    pbstrRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocid, Byte& piLevel, UInt64& ppermMask, Object& pvarBuildDependencySet, UInt32& pdwNumBuildDependencies,
    Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder, Guid& pgDocScopeId)     在 Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAndMetaInfo(String bstrUrl, Byte bPageView, Byte
    bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Int32 iRequestVersion, Byte bMainFileRequest, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean& pbGhostedDocument,
    Boolean& pbDefaultToPersonal, Boolean& pbIsWebWelcomePage, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion, String& pbstrTimeLastModified, String& pbstrContent, UInt32& pdwPartCount, Object& pvarMetaData, Object&
    pvarMultipleMeetingDoclibRootFolders, String& pbstrRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocid, Byte& piLevel, UInt64& ppermMask, Object&
    pvarBuildDependencySet, UInt32& pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder, Guid& pgDocScopeId)     在 Microsoft.SharePoint.Library.SPRequest.GetFileAndMetaInfo(String
    bstrUrl, Byte bPageView, Byte bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Int32 iRequestVersion, Byte bMainFileRequest, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean&
    pbGhostedDocument, Boolean& pbDefaultToPersonal, Boolean& pbIsWebWelcomePage, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion, String& pbstrTimeLastModified, String& pbstrContent, UInt32& pdwPartCount, Object&
    pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String& pbstrRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocid, Byte& piLevel,
    UInt64& ppermMask, Object& pvarBuildDependencySet, UInt32& pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder, Guid& pgDocScopeId)     在 Microsoft.SharePoint.SPWeb.GetWebPartPageContent(Uri
    pageUrl, Int32 pageVersion, PageView requestedView, HttpContext context, Boolean forRender, Boolean includeHidden, Boolean mainFileRequest, Boolean fetchDependencyInformation, Boolean& ghostedPage, String& siteRoot, Guid& siteId, Int64& bytes,
    Guid& docId, UInt32& docVersion, String& timeLastModified, Byte& level, Object& buildDependencySetData, UInt32& dependencyCount, Object& buildDependencies, SPWebPartCollectionInitialState& initialState, Object& oMultipleMeetingDoclibRootFolders,
    String& redirectUrl, Boolean& ObjectIsList, Guid& listId)     在 Microsoft.SharePoint.ApplicationRuntime.SPRequestModuleData.FetchWebPartPageInformationForInit(HttpContext context, SPWeb spweb, Boolean mainFileRequest, String
    path, Boolean impersonate, Boolean& isAppWeb, Boolean& fGhostedPage, Guid& docId, UInt32& docVersion, String& timeLastModified, SPFileLevel& spLevel, String& masterPageUrl, String& customMasterPageUrl, String& webUrl, String&
    siteUrl, Guid& siteId, Object& buildDependencySetData, SPWebPartCollectionInitialState& initialState, String& siteRoot, String& redirectUrl, Object& oMultipleMeetingDoclibRootFolders, Boolean& objectIsList, Guid& listId, Int64&
    bytes)     在 Microsoft.SharePoint.ApplicationRuntime.SPRequestModuleData.GetWebPartPageData(HttpContext context, String path, Boolean throwIfFileNotFound)     在 Microsoft.SharePoint.ApplicationRuntime.SPVirtualPathProvider.GetCacheKey(String
    virtualPath)     在 System.Web.Compilation.BuildManager.GetVPathBuildResultFromCacheInternal(VirtualPath virtualPath, Boolean ensureIsUpToDate)     在 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath
    virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)     在 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath
    virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)     在 System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath,
    Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)     在 System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection)    
    在 System.Web.UI.Page.ApplyMasterPage()     在 System.Web.UI.Page.PerformPreInit()     在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    
    在 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     在 System.Web.UI.Page.ProcessRequest()     在 System.Web.UI.Page.ProcessRequest(HttpContext context)    
    在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     在 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     在 System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception
    error)     在 System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)     在 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)    
    在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer,
    IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     在 System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     在 System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr
    pHandler, RequestNotificationStatus& notificationStatus)     在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)    
    在 System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
    Files
    Medium
    Spent 0 ms to bind 29783 byte file stream
    Monitoring
    High
    Leaving Monitored Scope (GetFileAndMetaInfo). 执行时间=17.6751425083646
    Monitoring
    High
    Leaving Monitored Scope (GetWebPartPageContent). 执行时间=17.8435806939653
    OpenXml
    Medium
    OfficePackageLibrary::OpenPackage(app=3, path=C:\Users\FarmAdmin\AppData\Local\Temp\tmpBFE2.tmp, fcm=3)
    Database
    High
    [Forced due to logging gap, Original Level: VerboseEx] Reverting to process identity
    Database
    High
    [Forced due to logging gap, cached @ 06/20/2014 14:36:33.08, Original Level: Verbose] SQL connection time: 0.0727483919888626
    Database
    High
    [Forced due to logging gap, Original Level: VerboseEx] Reverting to process identity
    Database
    High
    [Forced due to logging gap, cached @ 06/20/2014 14:36:35.00, Original Level: Verbose] SQL connection time: 0.07969118458531
    Database
    High
    [Forced due to logging gap, Original Level: VerboseEx] Reverting to process identity
    0xC33B005
    Assert
    ShipAssert location: (0)  condition:   StackTrace:  at onetnative.dll: (sig=7b7c0170-6822-4da2-8b1b-70510b777a4a|2|onetnative.pdb, offset=12700) at onetnative.dll: (offset=125F1)
    Unified Logging Service
    Monitorable
    Watson bucket parameters: Microsoft SharePoint Foundation 4, ULSShipAssert12, 2jtj, 15.0.4481.0
    0xEB2D00B
    High
    Metro library failure (0x80070005):
    0xEB2D00B
    High
    Metro library failure (0x80070005):
    0xEB2D005
    High
    Metro library failure (0x80070005):
    0xEB2D005
    High
    Metro library failure (0x80070005):
    0xEB2D005
    High
    Metro library failure (0x80070005):
    0xEB2D005
    High
    Metro library failure (0x80070005):
    0xC33B005
    Assert
    ShipAssert location: (0)  condition:   StackTrace:  at onetnative.dll: (sig=7b7c0170-6822-4da2-8b1b-70510b777a4a|2|onetnative.pdb, offset=12700) at onetnative.dll: (offset=125F1)
    Unified Logging Service
    Monitorable
    Watson bucket parameters: Microsoft SharePoint Foundation 4, ULSShipAssert12, 2jtj, 15.0.4481.0
    0xEB2D00B
    High
    Metro library failure (0x80070005):
    0xEB2D00B
    High
    Metro library failure (0x80070005):
    0xEB2D005
    High
    Metro library failure (0x80070005):
    0xEB2D005
    High
    Metro library failure (0x80070005):
    0xEB2D005
    High
    Metro library failure (0x80070005):
    0xEB2D005
    High
    Metro library failure (0x80070005):
    Database
    High
    [Forced due to logging gap, cached @ 06/20/2014 14:36:36.86, Original Level: Verbose] SQL connection time: 0.0706353681551612
    General
    Medium
    Application error when access /_layouts/15/CustomizeReport.aspx, Error=拒绝访问。 (异常来自 HRESULT:0x80030005 (STG_E_ACCESSDENIED))   在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode,
    IntPtr errorInfo)     在 Microsoft.Office.Server.OpenXml.Internal.ByteStream.Write(Byte[] rgb, Int32 offset, Int32 cb)     在 System.IO.BufferedStream.FlushWrite()     在 System.IO.StreamWriter.Dispose(Boolean
    disposing)     在 System.IO.StreamWriter.Close()     在 System.Xml.XmlTextWriter.Close()     在 Microsoft.Office.RecordsManagement.Reporting.AuditReportGenerator.Dispose()     在 Microsoft.Office.RecordsManagement.Reporting.ReportData.Dispose()    
    在 Microsoft.Office.RecordsManagement.Reporting.ReportBase.AggregateReports(Hashtable query, SPFolder folder, ReportNameGenerator reportNameGenerator)     在 Microsoft.Office.RecordsManagement.Reporting.ApplicationPages.CustomizeReport.OKBtn_Click(Object
    sender, EventArgs e)     在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    Runtime
    Unexpected
    System.Runtime.InteropServices.COMException: 拒绝访问。 (异常来自 HRESULT:0x80030005 (STG_E_ACCESSDENIED))    在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)    
    在 Microsoft.Office.Server.OpenXml.Internal.ByteStream.Write(Byte[] rgb, Int32 offset, Int32 cb)     在 System.IO.BufferedStream.FlushWrite()     在 System.IO.StreamWriter.Dispose(Boolean disposing)    
    在 System.IO.StreamWriter.Close()     在 System.Xml.XmlTextWriter.Close()     在 Microsoft.Office.RecordsManagement.Reporting.AuditReportGenerator.Dispose()     在 Microsoft.Office.RecordsManagement.Reporting.ReportData.Dispose()    
    在 Microsoft.Office.RecordsManagement.Reporting.ReportBase.AggregateReports(Hashtable query, SPFolder folder, ReportNameGenerator reportNameGenerator)     在 Microsoft.Office.RecordsManagement.Reporting.ApplicationPages.CustomizeReport.OKBtn_Click(Object
    sender, EventArgs e)     在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    General
    High
    Getting Error Message for Exception System.Web.HttpUnhandledException (0x80004005): 引发类型为“System.Web.HttpUnhandledException”的异常。 ---> System.Runtime.InteropServices.COMException (0x80030005): 拒绝访问。 (异常来自 HRESULT:0x80030005
    (STG_E_ACCESSDENIED))     在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)     在 Microsoft.Office.Server.OpenXml.Internal.ByteStream.Write(Byte[] rgb, Int32 offset,
    Int32 cb)     在 System.IO.BufferedStream.FlushWrite()     在 System.IO.StreamWriter.Dispose(Boolean disposing)     在 System.IO.StreamWriter.Close()     在 System.Xml.XmlTextWriter.Close()    
    在 Microsoft.Office.RecordsManagement.Reporting.AuditReportGenerator.Dispose()     在 Microsoft.Office.RecordsManagement.Reporting.ReportData.Dispose()     在 Microsoft.Office.RecordsManagement.Reporting.ReportBase.AggregateReports(Hashtable
    query, SPFolder folder, ReportNameGenerator reportNameGenerator)     在 Microsoft.Office.RecordsManagement.Reporting.ApplicationPages.CustomizeReport.OKBtn_Click(Object sender, EventArgs e)     在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String
    eventArgument)     在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     在 System.Web.UI.Page.HandleError(Exception e)     在 System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     在 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     在 System.Web.UI.Page.ProcessRequest()    
    在 System.Web.UI.Page.ProcessRequest(HttpContext context)     在 System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     在 System.Web.HttpApplication.ExecuteStep(IExecutionStep
    step, Boolean& completedSynchronously)

  • Script task fails to send mail to GMAIL

    Hi   guys ,
       I am new here and i am glad i that i am here.  I am working in a company  as SQL Server developer(T-sql), i am learning SSIS because  i wanted to move to data warehousing.
    I not familiar and i don't know any thing about  C#,  but i am learning SSIS on my own.
    I tried to send mail to gmail  using script task , both sender and receiver with same mail ID using variables which i tried using tutorial i found from the below link.
    [quote]http://www.codeproject.com/Articles/85172/Send-Email-from-SSIS-with-option-to-indicate-Email[/quote]
    but finally when i execute the task , it returns failure message and email is not sent.
    [quote]SSIS package "Send mail using script task.dtsx" starting.
    Error: 0x8 at Script Task: The script returned a failure result.
    Task failed: Script Task
    SSIS package "Send mail using script task.dtsx" finished: Success.
    [/quote]
    Below message taken from progress tab
    [quote]Error: The script returned a failure result.[/quote]
    Can you all please help me in  finding where i am going wrong? please check below code which i have used in script task.
    Microsoft SQL Server Integration Services Script Task
    Write scripts using Microsoft Visual C# 2008.
    The ScriptMain is the entry point class of the script.
    using System;
    using System.Data;
    using Microsoft.SqlServer.Dts.Runtime;
    using System.Windows.Forms;
    using System.Text.RegularExpressions;
    using System.Net.Mail;
    namespace ST_9bc84810a62a401aa44ddd905bcd369d.csproj
    [System.AddIn.AddIn("ScriptMain", Version = "1.0", Publisher = "", Description = "")]
    public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
    #region VSTA generated code
    enum ScriptResults
    Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    #endregion
    The execution engine calls this method when the task executes.
    To access the object model, use the Dts property. Connections, variables, events,
    and logging features are available as members of the Dts property as shown in the following examples.
    To reference a variable, call Dts.Variables["MyCaseSensitiveVariableName"].Value;
    To post a log entry, call Dts.Log("This is my log text", 999, null);
    To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, true);
    To use the connections collection use something like the following:
    ConnectionManager cm = Dts.Connections.Add("OLEDB");
    cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;";
    Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
    To open Help, press F1.
    public void Main()
    string sSubject = "Test Subject";
    string sBody = "Test Message";
    int iPriority = 2;
    if (SendMail(sSubject, sBody, iPriority))
    Dts.TaskResult = (int)ScriptResults.Success;
    else
    //Fails the Task
    Dts.TaskResult = (int)ScriptResults.Failure;
    public bool SendMail(string sSubject, string sMessage, int iPriority)
    try
    string sEmailServer = Dts.Variables["sEmailServer"].Value.ToString();
    string sEmailPort = Dts.Variables["sEmailPort"].Value.ToString();
    string sEmailUser = Dts.Variables["sEmailUser"].Value.ToString();
    string sEmailPassword = Dts.Variables["sEmailPassword"].Value.ToString();
    string sEmailSendTo = Dts.Variables["sEmailSendTo"].Value.ToString();
    string sEmailSendCC = Dts.Variables["sEmailSendCC"].Value.ToString();
    string sEmailSendFrom = Dts.Variables["sEmailSendFrom"].Value.ToString();
    string sEmailSendFromName = Dts.Variables["sEmailSendFromName"].Value.ToString();
    SmtpClient smtpClient = new SmtpClient();
    MailMessage message = new MailMessage();
    MailAddress fromAddress = new MailAddress(sEmailSendFrom, sEmailSendFromName);
    //You can have multiple emails separated by ;
    string[] sEmailTo = Regex.Split(sEmailSendTo, ";");
    string[] sEmailCC = Regex.Split(sEmailSendCC, ";");
    int sEmailServerSMTP = int.Parse(sEmailPort);
    smtpClient.Host = sEmailServer;
    smtpClient.Port = sEmailServerSMTP;
    System.Net.NetworkCredential myCredentials =
    new System.Net.NetworkCredential(sEmailUser, sEmailPassword);
    smtpClient.Credentials = myCredentials;
    message.From = fromAddress;
    if (sEmailTo != null)
    for (int i = 0; i < sEmailTo.Length; ++i)
    if (sEmailTo[i] != null && sEmailTo[i] != "")
    message.To.Add(sEmailTo[i]);
    if (sEmailCC != null)
    for (int i = 0; i < sEmailCC.Length; ++i)
    if (sEmailCC[i] != null && sEmailCC[i] != "")
    message.To.Add(sEmailCC[i]);
    switch (iPriority)
    case 1:
    message.Priority = MailPriority.High;
    break;
    case 3:
    message.Priority = MailPriority.Low;
    break;
    default:
    message.Priority = MailPriority.Normal;
    break;
    //You can enable this for Attachments.
    //SingleFile is a string variable for the file path.
    //foreach (string SingleFile in myFiles)
    // Attachment myAttachment = new Attachment(SingleFile);
    // message.Attachments.Add(myAttachment);
    message.Subject = sSubject;
    message.IsBodyHtml = true;
    message.Body = sMessage;
    smtpClient.Send(message);
    return true;
    catch (Exception ex)
    return false;
    Please help me resolve this guys ... THANKS IN ADVANCE

    Thank you very much for your reply @Elvis Long,
    Sorry for the late reply
    Actually, i am not trying or executing this task  from my office , but i am trying this at my home :( .
    sEmailPort has value 587 sEmailServer has smtp.gmail.com
    Can you please check whether this C# coding is correct or not ? because finally it gives error saying "Script
    Task: The script returned a failure result" 
    so can you please check this with your system and let me know what is wrong with this code
    Thanks in advance  

Maybe you are looking for