koltyakov / gosip

⚡️ SharePoint SDK for Go
https://go.spflow.com
MIT License
140 stars 32 forks source link

SPO changes format of custom ID #76

Open phhoef opened 5 months ago

phhoef commented 5 months ago

I am storing a few meta data through the item.Update function. One information is a custom id, that typically looks similar to this CF7F5BC8B5031EEEB6D978E8BD860E6A

I've introduced a custom type with additional fields to hold all of my information. The type of this field is text. In the web interface of SPO, the ID is shown exactly as the one above. But when I access the item through the API and get the same id with a different format cf7f5bc8-b503-1eee-b6d9-78e8bd860e6a. It now looks like a uuid ... Though, the field has the suffix OWSTEXT.

I am not sure if this is directly related to this library. Is there something wrong with my update function?

Versions SharePoint Online

koltyakov commented 5 months ago

Hi @phhoef,

That doesn't sound as a bug. The library fetches different SharePoint APIs and returns payloads with little or no transformations (only normalizations for OData verbosity).

Can you provide an exact sample for what you doing? Comparing response with what is returned from the API, e.g. using Postman could help to see if the data is returned the way you're getting it via the library.

phhoef commented 5 months ago

Hallo @koltyakov,

thanks for your fast reply 😄 You're right, it's probably not related to your lib.

I've a function that updates the properties.

func update(item *api.Item, props map[string]any) error {
    content, err := json.Marshal(props)
    if err != nil {
        return err
    }

    _, err = item.Update(content)
    return err
}

I accessed the property with the SharePoint Search Query tool, and the result is the same. If it's not going wrong during updating the properties, it's not related the lib.

Though, can you imagine why this is happening? It's driving me nuts. It's an id and SPO is changing the internal representation for some reason. The weird thing is, that it is displayed properly in the web interface. It's just how it is internally stored. My big problem is, that I do want to search for this ID, and it's super annoying, that it cannot be found by the original string.

image