Foros del Web » Programación para mayores de 30 ;) » .NET »

Necesito ayuda

Estas en el tema de Necesito ayuda en el foro de .NET en Foros del Web. Intento crear una cita en un Calendario de Exchange con el siguiento codigo: string strApptItem = ""; string strApptRequest = ""; string strMailInfo = ""; ...
  #1 (permalink)  
Antiguo 22/06/2005, 03:41
 
Fecha de Ingreso: abril-2005
Mensajes: 195
Antigüedad: 19 años
Puntos: 0
Necesito ayuda

Intento crear una cita en un Calendario de Exchange con el siguiento codigo:
string strApptItem = "";
string strApptRequest = "";
string strMailInfo = "";
string strCalInfo = "";
string strXMLNSInfo = "";
string strHeaderInfo = "";
System.Net.HttpWebRequest PROPPATCHRequest = null;
System.Net.WebResponse PROPPATCHResponse = null;
System.Net.CredentialCache MyCredentialCache = null;
byte[] bytes = null;
System.IO.Stream PROPPATCHRequestStream = null;

// Nombre del servidor
string ExchSvrName = this._server;

// Nombre de Mailbox
string user = Session["usuario"].ToString();

// Cita
strApptItem = "aspnet285.eml";
this._fichero = strApptItem;

// URI del calendario del usuario
// Carpetas publicas
this._url = "http://" + this._server + ":8080/public/Reservas/Coches/Ford Nomade";

//Usuario
//this._url = "http://" + this._server + ":8080/exchange/" + user + "/Calendario";

// Usuario y password del creador de la cita
string domain = Session["dominio"].ToString();
string password = Session["password"].ToString();

// XML namespace info for the WebDAV request.
strXMLNSInfo = "xmlns:g=\"DAV:\" " + "xmlns:e=\"http://schemas.microsoft.com/exchange/\" " + "xmlns:mapi=\"http://schemas.microsoft.com/mapi/\" "+ "xmlns:mapit=\"http://schemas.microsoft.com/mapi/proptag/\" "
+ "xmlns:x=\"xml:\" xmlns:cal=\"urn:schemas:calendar:\" "
+ "xmlns:dt=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\" "
+ "xmlns:header=\"urn:schemas:mailheader:\" "
+ "xmlns:mail=\"urn:schemas:httpmail:\"";


// Set the appointment item properties. To create an all-day meeting,
// set the dtstart/dtend range for 24 hours or more and set the alldayevent property
// to 1. See the documentation on the properties
// in the urn:schemas:calendar: namespace for more information.
strCalInfo = "<cal:location>WebDAV</cal:location>"
+ "<cal:dtstart dt:dt=\"dateTime.tz\">2005-06-26T23:00:00.000Z</cal:dtstart>"
+ "<cal:dtend dt:dt=\"dateTime.tz\">2005-06-26T23:30:00.000Z</cal:dtend>"
+ "<cal:instancetype dt:dt=\"int\">0</cal:instancetype>"
+ "<cal:busystatus>BUSY</cal:busystatus>"
+ "<cal:meetingstatus>CONFIRMED</cal:meetingstatus>"
+ "<cal:alldayevent dt:dt=\"boolean\">0</cal:alldayevent>"
+ "<cal:responserequested dt:dt=\"boolean\">1</cal:responserequested>"

// Set the reminder time (in seconds).
+ "<cal:reminderoffset dt:dt=\"int\">900</cal:reminderoffset>";

// Set the required attendee of the appointment.
strHeaderInfo = "<header:to>" + user + "</header:to>";

// Set the subject of the appointment.
strMailInfo = "<mail:subject>Insercion desde .NET</mail:subject>"
+ "<mail:htmldescription>otro nuevo archivo</mail:htmldescription>";

// Build the XML body of the PROPPATCH request.
strApptRequest = "<?xml version=\"1.0\"?>"
+ "<g:propertyupdate " + strXMLNSInfo + ">"
+ "<g:set><g:prop>"
+ "<g:contentclass>urn:content-classes:appointment</g:contentclass>"
+ "<e:outlookmessageclass>IPM.Appointment</e:outlookmessageclass>"
+ strMailInfo
+ strCalInfo
+ strHeaderInfo
+ "<mapi:finvited dt:dt=\"boolean\">1</mapi:finvited>"
+ "</g:prop></g:set>"
+ "</g:propertyupdate>";

// Create a new CredentialCache object and fill it with the network
// credentials required to access the server.
MyCredentialCache = new System.Net.CredentialCache();
MyCredentialCache.Add( new System.Uri(this._url),
"NTLM",
new System.Net.NetworkCredential(user, password, domain));

// Create the HttpWebRequest object.
PROPPATCHRequest = (System.Net.HttpWebRequest)HttpWebRequest.Create(t his._url + strApptItem);

// Add the network credentials to the request.
PROPPATCHRequest.Credentials = MyCredentialCache;

// Specify the PROPPATCH method.
PROPPATCHRequest.Method = "PROPPATCH";

// Encode the body using UTF-8.
bytes = Encoding.UTF8.GetBytes((string)strApptRequest);

// Set the content header length. This must be
// done before writing data to the request stream.
PROPPATCHRequest.ContentLength = bytes.Length;

// Get a reference to the request stream.
PROPPATCHRequestStream = PROPPATCHRequest.GetRequestStream();

// Write the message body to the request stream.
PROPPATCHRequestStream.Write(bytes, 0, bytes.Length);

// Close the Stream object to release the connection
// for further use.
PROPPATCHRequestStream.Close();

// Set the content type header.
PROPPATCHRequest.ContentType = "text/xml";

// Create the appointment in the Calendar folder of the
// user's mailbox.
PROPPATCHResponse = (System.Net.HttpWebResponse)PROPPATCHRequest.GetRe sponse();

// Clean up.
PROPPATCHResponse.Close();

Este codigo me inserta como "un mensaje" en la carpeta coches, pero no es capaz de meterlo en el calendario Ford Nomade.

Alguien sabria decirme algo

Salu2
  #2 (permalink)  
Antiguo 25/07/2005, 02:05
 
Fecha de Ingreso: abril-2005
Mensajes: 195
Antigüedad: 19 años
Puntos: 0
En primer lugar, la direccion debe de ser .../Ford Nomade/ y no .../Ford Nomade. Si despues de esto te da un error interno de servidor, entonces el problema esta en la configuracion de permiso para inserciones en el carpeta Ford Nomace
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:39.