Attribute 'Table' is not valid on this declaration type. It is valid on 'type' declarations only.

krishna572 876 Reputation points

I'm doing the Output Binding in Azure Functions .NET 6.

Whatever the input data I'm receiving, that passing to the table in the table storage but two errors I'm getting.

  1. Getting Table Attribute Error in declaration:

User's image

        [return: Table("DTOTable")]
        public static async Task<MyDTO> IOBindingTimerTrigger([TimerTrigger("0 */2 * * * *", RunOnStartup = true)] TimerInfo timerInfo,
            [Blob("devhack/input.txt", FileAccess.Read, Connection = "AzureWebJobsStorage")] Stream stream,
            ILogger log)
            StreamReader streamReader = new StreamReader(stream);
            JObject jObject = JsonConvert.DeserializeObject<JObject>(streamReader.ReadToEnd());
            MyDTO dto = new MyDTO()
                text = jObject
            return dto;

        public class MyDTO : TableEntity
            public MyDTO()
                this.PartitionKey = Guid.NewGuid().ToString();
                this.RowKey = "12345";

            public JObject text { get; set; }
  1. It is working in my colleague's system but text object not adding to table. Only Partition key and row key is adding. Jobject data is not adding to the text object.

Could anyone help me where I'm doing wrong?

Azure Table Storage
Azure Table Storage
An Azure service that stores structured NoSQL data in the cloud.
162 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,515 questions
Microsoft Technologies based on the .NET software framework.
3,547 questions
{count} vote

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,256 Reputation points

    Vaishnavi Thank you for posting this question in Microsoft Q&A.

    For the first part, based on discussion: 'Attribute 'Table' is not valid for this declaration type’, you are missing extension either Microsoft.Azure.WebJobs.Extensions.Tables or Microsoft.Azure.WebJobs.Extensions.Storage depending on the version you use as described here. Adding the necessary extension should fix this issue.

    In the Second part, you are trying to save JObject directly and I don't think Azure Table Storage supports it. You would have to process JSON data and save it in Table Storage and here is an example: (similar thread: Or you can save it as string (JObject) and then process it in your application code.

    I hope this helps with your question and let me know if any questions.

    If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful