2

I am trying to write a custom web service and using following code snippet from Fuel SDK documentation

Using FuelSDK;  
ET_Client myclient = new ET_Client();  
ET_DataExtensionColumn dataextensioncolumn = new ET_DataExtensionColumn();  
dataextensioncolumn.AuthStub = myclient;  
PostReturn response = dataextensioncolumn.Post();  
Console.WriteLine("Post Status: " + response.Status.ToString());  

However, I am getting error at this line of code at Post menthod call

PostReturn response = dataextensioncolumn.Post(); 

Error: C# does not contain a definition for and no extension method accepting a first argument of type could be found

Note- I am using Fuel SDK and same is added to my project in C#

1
1

ET_DataExtensionColumn class does not have a Post method. You should call that method in ETDataExtension with the row properly configured.

You can take a look here: ETDataExtension

public class ETDataExtension : DataExtension
{
    internal string FolderMediaType = "dataextension";

    public int? FolderID { get; set; }

    public ETDataExtensionColumn[] Columns { get; set; }

    public PostReturn Post()
    {
        ETDataExtension de = this;
        de.Fields = Columns;
        de.Columns = null;
        var pr = new PostReturn(de);
        foreach (var rd in pr.Results)
        {
            ((ETDataExtension)rd.Object).Columns = (ETDataExtensionColumn[])((ETDataExtension)rd.Object).Fields;
            ((ETDataExtension)rd.Object).Fields = null;
        }
        return pr;
    }

    public PatchReturn Patch()
    {
        ETDataExtension de = this;
        de.Fields = Columns;
        de.Columns = null;
        var pr = new PatchReturn(de);
        foreach (var rd in pr.Results)
        {
            ((ETDataExtension)rd.Object).Columns = (ETDataExtensionColumn[])((ETDataExtension)rd.Object).Fields;
            ((ETDataExtension)rd.Object).Fields = null;
        }
        return pr;
    }

    public DeleteReturn Delete()
    {
        ETDataExtension de = this;
        de.Fields = Columns;
        return new DeleteReturn(de);
    }

    public GetReturn Get()
    {
        var r = new GetReturn(this);
        LastRequestID = r.RequestID;
        foreach (ETDataExtension rd in r.Results)
        {
            rd.Columns = (ETDataExtensionColumn[])rd.Fields;
            rd.Fields = null;
        }
        return r;
    }

    public GetReturn GetMoreResults()
    {
        var r = new GetReturn(this, true, null);
        LastRequestID = r.RequestID;
        foreach (ETDataExtension rd in r.Results)
        {
            rd.Columns = (ETDataExtensionColumn[])rd.Fields;
            rd.Fields = null;
        }
        return r;
    }

    public InfoReturn Info() { return new InfoReturn(this); }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.