+ Start a Discussion
Ralitsa DakovaRalitsa Dakova 

Error in C#: The type or namespace name 'Account' could not be found (are you missing a using directive or an assembly reference?)

Hello,
I'm trying to get a SOAP API to retrieve the details of a certain account/accounts using the IDs I got from getUpdated call. 
My code was working fine until now - here is where I get an error: 

Account retrievedAccount = (Account)arrayIDs[0];

Here is the full (almost) code I have:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SFAPITest.salesforce;
using System.Web.Services.Protocols;
using SFAPITest;


namespace SFAPITest
{
    class Program
    {
        static void Main(string[] args)
        {

            SforceService binding = new SforceService();
            var result = binding.login("username", "pass");
          
            binding.Url = result.serverUrl;

            binding.SessionHeaderValue = new SessionHeader();
            binding.SessionHeaderValue.sessionId = result.sessionId; 

            Console.WriteLine("Server URL: " + result.serverUrl);
            Console.WriteLine("Session ID: " + result.sessionId);

            GetUpdatedResult updatedObj = binding.getUpdated("Account", DateTime.Today, DateTime.Today.AddDays(1)); 

            sObject[] arrayIDs = binding.retrieve("Type", "Account", updatedObj.ids);
            Account retrievedAccount = (Account)arrayIDs[0];

            Console.ReadKey(); 
        }
    }
}


The error is "The type or namespace name 'Account' could not be found (are you missing a using directive or an assembly reference?)"

Please help - have a missed a part of the documentation? I'm using Visual studio 2008 (I know, a little old - will a newer version help?). Just to confirm - I have NOT renamed the project - I see that has been kind of an issue for other users.

Thank you!
Yogesh KulkarniYogesh Kulkarni
Hi Ralista,

Can you check if you have reference added to System.Web.Services in project Rererences section.

Thanks,
Yogesh
Ralitsa DakovaRalitsa Dakova
I have downloaded the link from a test account, which is going to expire shortly. I don't have a developer account. Does that make any difference?
I am seeing in the resharper that there is NO Account defined anywhere in the SFDC API link/reference. Am I supposed to first create the type Account somewhere else?Am I missing this because I don't have a developer account?