Visualizzazione dei risultati da 1 a 5 su 5

Discussione: Classi CRM

  1. #1

    Classi Proxy

    Allora sto usando delle classi proprie del CRM
    premetto che di Asp Net ne capisco pochino e quel poco che so lo conosco in VB
    Ho trovato questo script in C# su MSDN ma mi da errori a bizzeffe...
    codice:
    <%@ Page Language="C#" Debug="true"%>
    <%@ Import Namespace="Microsoft.Crm.Platform.Proxy" %>
    <%@ Import Namespace="System.Net" %>
    <Script Runat="Server">
    // strServer should be set with the name of the platform Web server
    string strServer = "boserver";
    
    // virtualDirectory should be set with the name of the Microsoft CRM
    // virtual directory on the platform Web server
    string virtualDirectory = "MSCRMServices";
    string strDir = "http://" + strServer + "/" + virtualDirectory + "/";
    
    //BizUser proxy object
    Microsoft.Crm.Platform.Proxy.BizUser bizUser = new Microsoft.Crm.Platform.Proxy.BizUser();
    bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
    bizUser.Url = strDir + "BizUser.srf";
    
    // CRMIncident proxy object
    Microsoft.Crm.Platform.Proxy.CRMIncident incident = new Microsoft.Crm.Platform.Proxy.CRMIncident();
    incident.Credentials = System.Net.CredentialCache.DefaultCredentials;
    incident.Url = strDir + "CRMIncident.srf";
    string strErrorMsg;
    string strIncidentXml;
    string strIncidentId;
    string strAccountId = "{3E24E79C-7EC5-4473-95FF-7E46FEBB534B}";
    string strCustomerId = "{ECF99EF1-3858-4E06-ABD9-EBFE526BF9FF}";
    
    try
    {
    Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();
    
    // Set up the XML string for the new incident
    strIncidentXml = "<incident>";
    strIncidentXml += "<title>Incident 1</title>";
    strIncidentXml += "<accountid>" + strAccountId +"</accountid>";
    strIncidentXml += "<ownerid type=\"" + Microsoft.Crm.Platform.Types.ObjectType.otSystemUser.ToString() +"\">";
    strIncidentXml += userAuth.UserId + "</ownerid>";
    strIncidentXml += "<customerid type=\"" + Microsoft.CRM.Flags.ObjectType.otSystemUser.ToString() +"\">";
    strIncidentXml += strCustomerId + "</ownerid>";
    strIncidentXml += "</incident>";
    
    // Create an incident
    strIncidentId = incident.Create(userAuth, strIncidentXml);
    }
    catch (System.Web.Services.Protocols.SoapException err)
    {
    // Process the platform error here
    strErrorMsg = ("ErrorMessage: " + err.Message + " " + err.Detail.OuterXml + " Source: " + err.Source );
    }
    catch (Exception err)
    {
    // Process other errors here
    strErrorMsg = ("ErrorMessage: " + err.Message );
    }
    </script>
    Il primo errore è :
    CS1519: Invalid token '=' in class, struct, or interface member declaration
    qui :
    codice:
    Line 15: bizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
    Qualcuno sa aiutarmi per favore....

  2. #2
    Nessuno mi sa dire se il mio codice è sintatticcamente esatto?

  3. #3
    la sintassi è esatta.

    ci sarà qualcos'altro sotto

  4. #4
    Utente bannato
    Registrato dal
    Jun 2004
    Messaggi
    1,117
    OT... a cosa servono questa classi CRM?

    Quando vengono utilizzate?

  5. #5
    Per aggiungere un incident nel mio caso ma servono a mille cose diverse...



    Ho scoperto che mancano (Sul server) le DLL con le classi!!
    (il buon sistemista mi ha assicurato che c'erano)

    Come posso fare per metterle
    io le dll ce l'ho
    ora le copio nella directory bin e poi?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.