Skip to content

Example on how to add Fields to an existing item? #85

Closed

Description

@almostjulian

I've been trying to add a new field to an existing item without much success.

var items = onePasswordClient.GetItems(myVault)
var item = items.First(x => x.Title == "My Title")

//As is the existing fields collection is null, I need to do this to get fields
item = onePasswordClient.GetItem(item, myVault)

item.Fields.Add(new Field("My new field", FieldType.Concealed, "My New value"));
// This doesn't actually edit the item with the new field
onePasswordClient.EditItem(item, myVault);

Do I need to do something differently?

Activity

  1. knippers commented on Dec 3, 2024

    @knippers
    Contributor

    If your item is based on a custom template item, it might be the issue described in this PR: #81

  2. jscarle commented on Mar 9, 2026

    @jscarle
    Owner

    Resolved by #102. That change added regression coverage to verify \EditItem(...)\ preserves a custom-template item's \category_id\ during edits, and it clarified the hydrate-edit-save flow in the docs for updating existing items and adding fields. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions