How to call another class function in SharePoint?

Facing 'ConvertViewToHtml' does not exit in current context. Here is my code:
namespace ChangeControl3_Nov
class eGA_Utility
public static void SendmailwithTwo(string To, string subject, string Body, string frommail, byte[] docFile, byte[] docFile1, string fileName1, string fileName3)
string smtpServer = SPAdministrationWebApplication.Local.OutboundMailServiceInstance.Server.Address;
string smtpFrom = SPAdministrationWebApplication.Local.OutboundMailSenderAddress;
string smtpReplyTo = SPAdministrationWebApplication.Local.OutboundMailReplyToAddress;
MailMessage mailMessage = new MailMessage();
System.Net.Mail.MailAddress from = new System.Net.Mail.MailAddress(frommail, "Quality Management");
mailMessage.From = from;
mailMessage.To.Add(new MailAddress(To));
mailMessage.Subject = subject;
mailMessage.IsBodyHtml = true;
mailMessage.Priority = MailPriority.High;
mailMessage.Body = ConvertViewToHtml();
MemoryStream stream = new MemoryStream(docFile);
string fileName2 = fileName1;
Attachment attachment = new Attachment(stream, fileName2);
mailMessage.Attachments.Add(attachment);
MemoryStream stream1 = new MemoryStream(docFile1);
string fileName4 = fileName3;
Attachment attachment1 = new Attachment(stream1, fileName4);
mailMessage.Attachments.Add(attachment1);
SmtpClient smtpClient = new SmtpClient(smtpServer);
NetworkCredential oCredential = new NetworkCredential("", "");
try
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = oCredential;
smtpClient.Send(mailMessage);
catch (Exception)
I would like to call "ConvertViewToHtml()" from FormCode.cs in this line: 
mailMessage.Body = ConvertViewToHtml();
namespace ChangeControl3_Nov
public partial class FormCode
public string ConvertViewToHtml()
try
byte[] sourceFile = null;
XPathNavigator root = MainDataSource.CreateNavigator();
string myViewName = this.CurrentView.ViewInfo.Name.Replace(" ", string.Empty);
string myViewXslFile = myViewName + ".xsl";
// Create the xsl transformer
XslCompiledTransform transform = new XslCompiledTransform();
transform.Load(ExtractFromPackage(myViewXslFile));
// Generate a temporary HTML file
string fileName = Guid.NewGuid().ToString() + ".htm";
string filePath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), fileName);
using (XmlWriter writer = XmlWriter.Create(filePath))
// Convert the XML to HTML
transform.Transform(root, writer);
writer.Close();
// Return the HTML as a string
sourceFile = File.ReadAllBytes(filePath);
return System.Text.Encoding.UTF8.GetString(sourceFile);
catch (Exception ex)
return "<html><body>Unable to convert the view to HTML <p>" + ex.Message + "</p></body></html>";
How to do this? Thanks in advance!

Hi Sam,
According to your description, you might want to call a function from other class.
Before calling this function, it will require to initialize a FormCode object and then we can call the functions of the FormCode class.
You can take a look at the code snippet provided by tompsonn in this similar thread:
http://www.overclock.net/t/1411342/calling-a-function-from-another-form-c
More information about working with Partial Classes and Methods:
http://msdn.microsoft.com/en-us/library/wa80x488.aspx
Thanks 

Similar Messages

  • Access another class function

    Hey,
    I am trying to access another class function. I have 2 Classes and my main menu features are in my Main Class and I want to call that function from my Level Class
    What is a good idea to approach this, some how I need to import it in a way but I don't know how I could do that.
    Thanks,
    McbainGames11

    Fixed it myself
    Answer:
                        public static var instance:Main;
                        public function Main()
                                  instance = this;
    And I called a function from Main Class in my Level Class using:
    Main.instance.function();

  • How to call the 'DETAIL' function in ALV for a program?

    Dear Friends,
    I have a prf_tree (TYPE REF TO cl_gui_alv_tree), and I added below codes to add an new button for displaying the detail record, it works fine:
    CALL METHOD prf_toolbar->add_button
        EXPORTING
          fcode     = prf_tree->mc_fc_detail
          icon      = icon_detail
          butn_type = cntb_btype_button
          text      = ''
          quickinfo = 'Show Details'.
    Everytime I click this new button, a window will popup and display the record details.
    My question is: how to call this standard function  ('DETAIL' function) in a program? for example:
    CASE ldf_ok_code.
        WHEN gcf_okcode_save.
          PERFORM okcode_save.
        WHEN 'SHOW_DETAIL'.
          CHECK  gdf_nodkey_9003 IS NOT INITIAL.
          PERFORM SHOW_DETAIL.(How to write this code to display the detail data of the selected record?)
      Thanks a lot!

    Hi,
    Go for Interactive Reporting
    like When u click on the output then it will show the Detail report u want .
    for that purpose Pls
    Use Hide command .
    And call another report
    by using SUBMITT Program

  • How to Call another screen using the ABAP Report which is displaying ALV ou

    Hello All,
    I am developing a ABAP report in which I want to transfer the stock from material to another material.
    My Report will include 3 to screens.
    The first sleection screen will display all the material with their stock value.
    When we execute the report I will get the list of materials along with their current stock. On the top of the output screen I want the Execute button. Also , each line of the output should have checkbox or the ALV provides the functionality of editing one cell like that.....Once the user tick the checkbox or the cell....then I want to move to another screen where user can enter the Quantity and then user will tick ok and then I will call one function module so that the material documnet is posted and transfer of posting form material to material is done successfully.
    Could anyone please help me out how to call another screen from the output screen where user can enter the Quantity amount....
    I dont want to use the Dialog programming.....I want to create the simple ALV Abap report.
    Regards,
    Komal Bhutada.

    Hi Raymond,
    Thanks for the input...I will try this in my code .....
    Can you please help me how to insert the checkbox in the ALV Output....so that I can select one of row and then press execute to process further?..
    Thanks for the information.
    Regards,
    Komal.

  • Calling another class file

    I am trying to write an app to that calls another class file but i keep getting this error:
    "Message.java": Error #: 300 : class Attachment not found in class Message at line 229, column 37
    And this is the code where i am getting this error:
    public final void addAttachment(Attachment attachment)
    attachments.add(attachment);
    Can someone tell me what i am doing wrong or how to fix this?
    Thank you.

    This query brings up another point that is unrelated but of interest to me. Take a look at that method, addAttachment. All it does is call add(attachment) on an object variable that's not even lexically scoped. Is there really any benefit, any savings whatsoever in readability or ease of programming etc. in having that method? As it stands, I tend to view it as an exercise in typing. I see this a lot and so I wonder if it's just a Java thing or what.

  • Compiling a class calling another class

    Hi,
    I have a problem with running an applet.
    my applet contains a thread and calls another class.
    when i compile it with javac, it says "cannot resolve symbol class Compute" which is the name of the other class.
    thank you for your help.

    Hi friend,
    How you solved this problem? can u please explain me
    too...
    I've an error while compiling my java file. cannot
    resolve symbol : class Student.
    where my two java files are...
    StudentBean.java
    public class StudentBean
    public static void main(String args[])
    Student s = new Student();
    Student.java
    public class Student
    String id,name;
    public Student(String id,String name)
    this.id = id;
    this.name = name;
    Both are in the same folder, please help me out of it.
    Thanking you,
    Harshavardhan.I do not know about the symbol resolution. But you do not have a default constructor in Student which may be causing an issue with the compile.

  • How to call java class from pl/sql procedure ?

    Hello everyone,
    My query is..
    There is one pl/sql stored procedure which is doing some business logic and storing data in some columns of one table, suppose the table name is 'ABC' .. and the rest of columns of table ABC are getting updated using java class. Now my problem is whenever I insert data in ABC using store proc.. i have to call that java class so that it will update the rest columns ( why java class for updating the columns in ABC is ..because that logic cant be done from pl/sql proc.. it has to be done using java )
    and the other thing is.. oracle is in one machine and java is in another .. :(
    hope ..u can help me out !!
    Thank in advance !!

    but that updation have to be done from java code only.. we are using GIS tools .. have to create some shape files and update the column with that shape file.. so creation of shape file has to be done from java code only..
    so how to call java class file which is on another machine and oracle in another..

  • How to call a SQL function from an XSL expression

    Hi
    In R12, in Payroll Deposit adivce/Check writer, We need to sort the earnings tag <AC_Earnings> in to two different categories as regular and other earnings. In the DB and form level of element defintiion we have a DFF which differentiates between the two kinds of earnings. But the seeded XML that is gerneated by the check writer does not have this field.
    The seeded template displays all the earnings in one column. How can we achieve this in the template without modifying the seeded XML.
    The one approach i have is to write a function and based on the return value sort the data. For this I need to know :
    1) How to call a SQL function from an XSL expression that is allowed in BI template.
    If anyone ahs faced similar requirements please share your approach.
    Thanks
    Srimathi

    Thank u..
    but i'd seen that link wen i searched in google..
    Is it possible without using any 3rd party JARs and all?
    and more importantly plz tell me what should be preferred way to call a javascript function?
    Do it using addLoadEvent() or Windows.Load etc
    OR
    Call it thru Xsl? (I donno how to do dis)
    Thanks in Advance..
    Edited by: ranjjose on Jun 3, 2008 8:21 AM

  • How to Implement custom share functionality in SharePoint 2013 document Lib programmatically?

    Hi,
    I have created custom action for Share functionality in document library.
    On Share action i'm showing Model pop up with Share form with addition functionality.
    I am developing custom share functionality because there is some addition functionality related to this.
    How to Implement custom share functionality in SharePoint 2013  document Lib pro-grammatically?
    Regards,
    - Siddhehswar

    Hi Siddhehswar:
    I would suggest that you use the
    Ribbon. Because this is a flexible way for SharePoint. In my project experience, I always suggest my customers to use it. In the feature, if my customers have customization about permission then i can accomplish this as soon
    as possible. Simple put, I utilize this perfect mechanism to resolve our complex project requirement. Maybe we customize Upload/ Edit/ Modify/ Barcode/ Send mail etc... For example:
    We customize <Edit> Ribbon. As shown below.
    When user click <Edit Item>, the system will
    render customized pop up window.
    Will

  • How to call a Javascript function from backing bean without any event

    Hi,
    Someone knows how to call a Javascript function from backing bean without any event ?
    thanks

    Please review the following thread:
    ADF Faces call javascript
    Luis.

  • How to call java script function from JSP ?

    how to call java script function from JSP ?

    i have function created by java script lets say x and i want to call this function from jsp scriplet tag which is at the same page ..thanks

  • One Class Calling Another Class ......Need Help..ugh

    this is the class that calls another class called cuboid
    package WindowsApplication1;
    * Summary description for Cuboid.
    //Import the classes to allow the use of the array, iterator and listiterator
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.ListIterator;
    public class DisplayCuboidValues
         public static void main(String args[])
              //Create the array list
              ArrayList VolumeList = new ArrayList();
              //Create the counter to loop 4 times and get 4 different volumes. Modify the counter
              //if you need a different values
              int Counter = 1;
              //Initialize the counter to loop 4 times in order to get the 4 objects
              while (Counter < 5)
                   Cuboid mp = new Cuboid(2, 4, 3);
                   //Add the values to the array
                   VolumeList.add(mp);
                   // get the volume again via accessor method(Optional)
                   //int Volume = mp.Volume();
                   //System.out.println(Volume);
                   //Increment the counter to obtain a new value in the array
                   Counter = Counter + 1;
              // Retrieve iterator to the radiuslist
              Iterator itr1 = VolumeList.iterator();
              while (itr1.hasNext())
              // call Cuboid.toString()
              System.out.print(itr1.next());
              System.out.println();
    }this is the cuboid class
    package WindowsApplication1;
    * Summary description for Cuboid.
    public class Cuboid
         private final int length, width, height;
         //1st contructor with 3 arguments
         public Cuboid(int length, int width, int height)
              this.length = length;
              this.width = width;
              this.height = height;
         //2nd constructor with no arguments
    //I BELIEVE THIS PUBLIC CUBOID IS THE ONE THE PROVOKES THE ERROR. BUT I CAN NOT DELETE IT BECAUSE I NEED ANOTHER PUBLIC CUBOID. SO IDK WHAT TO DO......
         public Cuboid()
              this.length = length;
              this.width = width;
              this.height = height;
            public String toString() {
                   return "This cuboid has length x, width y, height z, and has volume of v where X=" + length + " " + "Y=" + width + " " + "Z=" + height + " " + "Volume=" + length * width * height + ".   --   ";
         //Method to calculate the Volume
         public int Volume()
              return length * width * height;
         }This is what i have done. I have created a project named ths(which i do not use it at all). Then, i created one file called DisplayCuboidValues under ths. Then i created the file Cuboid under ths too. But it gives me errors. like this one:
    init:
    deps-jar:
    Created dir: C:\Documents and Settings\Owner\ths\build\classes
    Compiling 1 source file to C:\Documents and Settings\Owner\ths\build\classes
    C:\Documents and Settings\Owner\ths\src\DisplayCuboidValues\Cuboid.java:25: variable length might not have been initialized
    this.length = length;
    *^*
    C:\Documents and Settings\Owner\ths\src\DisplayCuboidValues\Cuboid.java:26: variable width might not have been initialized
    this.width = width;
    *^*
    C:\Documents and Settings\Owner\ths\src\DisplayCuboidValues\Cuboid.java:27: variable height might not have been initialized
    this.height = height;
    *^*
    Note: C:\Documents and Settings\Owner\ths\src\DisplayCuboidValues\DisplayCuboidValues.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    *3 errors*
    BUILD FAILED (total time: 0 seconds)
    Any help you can give me will be appreciated. Thanks.

    yeah. you are right in that. so that means that i have to get rid of it??. because i will need it. and the values assigned to them is in the first class that calls the second class look:
    package WindowsApplication1;
    * Summary description for Cuboid.
    //Import the classes to allow the use of the array, iterator and listiterator
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.ListIterator;
    public class DisplayCuboidValues
         public static void main(String args[])
              //Create the array list
              ArrayList VolumeList = new ArrayList();
              //Create the counter to loop 4 times and get 4 different volumes. Modify the counter
              //if you need a different values
              int Counter = 1;
              //Initialize the counter to loop 4 times in order to get the 4 objects
              while (Counter < 5)
    *//HERE IS WHERE I AM PROVIDING THE OTHER CLASS WITH VALUES. THEREFORE IT SHOULD SENT THOSE VALUES TO MY CLASS CUBOID AND RETRIEVE THE ANSWER TO FOLLOW THE REST OF THIS CODE.*
                   Cuboid mp = new Cuboid(2, 4, 3);
                   //Add the values to the array
                   VolumeList.add(mp);
                   // get the volume again via accessor method(Optional)
                   //int Volume = mp.Volume();
                   //System.out.println(Volume);
                   //Increment the counter to obtain a new value in the array
                   Counter = Counter + 1;
              // Retrieve iterator to the radiuslist
              Iterator itr1 = VolumeList.iterator();
              while (itr1.hasNext())
              // call Cuboid.toString()
              System.out.print(itr1.next());
              System.out.println();
    }

  • How to call a class that extends a frame from a panel ?

    How to call a class that extends a frame from a panel ?
    I am trying to create an application say "Videoshow"
    Videoshow has a panel which in turn consists of 2 components : 1]a textarea( to show the contents of a page) and 2] a mediaclip(to show the video).
    Now I have an application "MediaApplication"(to show the videoclip) which extends Frame (Code from Java 2 Unleashed, Chap 21). I want to show this MediaApplication in Component 2 of the above panel. But when I do this, I only see the MediaApplication frame instead of the whole SlideShow.
    I want to do something likethis.
    VideoShow :
    |---------------------------------|-------------------|
    | |
    | (Comp 1) | (Comp 2)
    | TEXTAREA | Video Clip
    | |(MediaApp entends Frame)
    |---------------------------------|-------------------|
    What is the best way to achieve this ? Also which component can I use to show the videoclip ?

    im not familiar with the code you mention from Java 2 Unleashed, but your best bet is to read up on Swing a bit - so you get an idea of how Swing containers and components work - then im sure you'll find a solution to your problems. Then if you encounter any difficulties whilst your attempting to do that, post your code in the Swing forum and im sure someone will help you.

  • How to  call library classes threw xml

    In my flash library has "MC",
    var xml:XML=<m c="MC"></m>
    How to call MC class threw xml.

    It's a bit cryptic but I think you mean like this:
    import flash.utils.getDefinitionByName;
    import flash.display.MovieClip;
    var xml:XML = <m c="MC"></m>;
    var classRef:Class = getDefinitionByName(xml.@c) as Class;
    var movieclip:MovieClip = new classRef() as MovieClip;
    addChild(movieclip);
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • How to call another view controller's method from a view controller?

    Hi,
    Iam new to webdynpro . so pls clarify my doubt.
    How to call another view controller's method from a view controller in the same Web Dynpro Component?
    Thanks,
    Krishna

    Hi,
         The methods in a view are only accessible inside same view. you cannot call it outside the view or
         in any other view although its in same component.
         If you want to have a method in both views, then create the method in component controller and
         from there you can access the method any where in whole component.

Maybe you are looking for

  • Open a crystal report from WAD with passing  the variables values

    Hi, I need to know is there any way to link SAP WAD to crystal reports (open a crystal report from WAD)and pass the values of the variables which are entered in the Web App. (e.g. Customer id,year) should be passed to the Crystal Report. Maybe we nee

  • ::MacBook 2,1 OVERHEATS when idle::

    Hi everyone. My arising concern led me to write this up regarding heat issues with my MacBook. Since my 2nd day of owning it, in January 2007, I installed BootCamp Beta that corrupted approximately 20GB. THinking it'd be no concern to me, I've lived

  • Stop phone vibrating when receiving emails in silent mode

    Hi, I have an iphone 4 and the iOS5 update.  I mainly have my phone switched to silent mode which is fine for receiving texts and calls as I prefer it to vibrate, but how can I stop it vibrating every time I receive an email without disabling silent

  • InDesign Showing white line on bottom and right sides

    I made sure that my design overlapped for bleed however when exporting to a PDF file it's showing a white line on the bottom and right of the design. I double check to make sure there is overlap and it's still showing up. I have tried searching to se

  • Build fails libgig-svn 2266-1 (AUR)

    This package fails to build with the following error: ./configure: line 14891: syntax error near unexpected token `SNDFILE,' ./configure: line 14891: `PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.2, ac_cv_sndfile=1, ac_cv_sndfile=0)' Could someone let m