C# Files Sample
1. Create Project

Open Visual Studio .NET IDE
Open "File->New->Project...
Find on the left panel icon "Console Application" and click it
Enter the name of poject, for ex. ACApp in "Name" field
Enter proper location of the new project
Click <OK> button

2. Add Web Service References

Open menu Project->Add Web Reference...
Enter Across Communications' web server in Address field, for ex.:
http://ws.AcrossCommunications.com/Personalizer.asmx

If it's OK click Add Reference button at the bottom of form
Open menu View->Solution Exporer
Open ACApp project and Web References folder
Click on AcrossCommunication Web reference and press F2 key.
Rename it to "PersonalizerRef"

Add other web references as "Session" and "Files" to your project in such manner.

3. Add functional Code

Open source code of "Class1.cs" and add folowing code lines into the Main function:

  //Create personalizer object and Session object
  PersonalizerRef.Personalizer pers = new PersonalizerRef.Personalizer() ;
  SessionRef.Session sess = new SessionRef.Session() ;
  string SessionID = "";
  try{
      SessionID = pers.CreateSession("LogonName", "Password");
      //Read file (file.wav) from disk
      FileStream fstream = File.OpenRead("file.wav");
      Byte [] bytedata = new Byte[fstream.Length];
      int readcnt = fstream.Read(bytedata,0,bytedata.Length);
      fstream.Close();
      //Create Files Object
      FilesRef.Files objFiles = new FilesRef.Files() ;
      //Get Files object ID
      string FilesID = sess.GetFiles(SessionID) ;
      //Create file
      objFiles.CreateFile(FilesID, "filename.wav", "speak prompt", bytedata);
      string FileName;
      //Get first filename
      FileName=objFiles.GetFirstFile(FilesID);
      while(FileName!=""){
          //Print file name
          Console.WriteLine("Found File=" + FileName);
          FileName = objFiles.GetNextFile(FilesID);
      }
      sess.Release(SessionID);
  }
  catch(Exception e){
      //Print exception message e.Message
      sess.Release(SessionID);
  }

Enter correct values instead of LogonName and Password.

4. Run application

Run menu Build->Build ACApp
Press F5 to run application.

													
Copyright by Acrosscommunications.com 2002