You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am having an issue with Collections, in detail when SharePoint returns a Collection(Int 32).
I'm trying to take from the website all the supported UI languages, which by documentation is returned as a Collection of Int 32 at the following endpoint: https://<website.link>/_api/Web/SupportedUILanguageIds
I noticed that there wasn't a method in this library to retrieve this kind of information, so I implemented a fairly simple one following the implementation of getRoleDefinitions and other methods available in the Web class.
The collection is declared as a "ClientObjectCollection", even if I'm not sure that is the right kind of object.
Here is the code (note I am passing the Web object to avoid modify the library directly):
and due to PHP considering 0 equal to every string no matter what, and the return value parsed as an array with key as an integer starting with 0, I am always missing the first value.
Is that intended?
Or should be the function changed with the added condition && is_string($key)?
Thank you.
The text was updated successfully, but these errors were encountered:
Indeed, since Web.SupportedUILanguageIds is a primitive property (represented as a collection of signed integer values) it was not properly serialized/deserialized.
In another words, the getSupportedUILanguageIds function represents a valid way for getting so called navigation properties
public function getSupportedUILanguageIds(Web $web)
{
if(!$web->isPropertyAvailable('SupportedUILanguageIds')){
$collection= new ClientObjectCollection($web->getContext(),new ResourcePathEntity($web->getContext(),$web->getResourcePath(),"SupportedUILanguageIds"));
$web->setProperty("SupportedUILanguageIds", $collection);
}
return $web->getProperty("SupportedUILanguageIds");
}
but not for a primitive properties such as Web.SupportedUILanguageIds .
Hi,
I am having an issue with Collections, in detail when SharePoint returns a Collection(Int 32).
I'm trying to take from the website all the supported UI languages, which by documentation is returned as a Collection of Int 32 at the following endpoint: https://<website.link>/_api/Web/SupportedUILanguageIds
I noticed that there wasn't a method in this library to retrieve this kind of information, so I implemented a fairly simple one following the implementation of getRoleDefinitions and other methods available in the Web class.
The collection is declared as a "ClientObjectCollection", even if I'm not sure that is the right kind of object.
Here is the code (note I am passing the Web object to avoid modify the library directly):
So, first question: is that the right object to use? If not, what is the right one?
The call seems to work fine, however due to a validation check in the ODataPayload class, specifically this function:
and due to PHP considering 0 equal to every string no matter what, and the return value parsed as an array with key as an integer starting with 0, I am always missing the first value.
Is that intended?
Or should be the function changed with the added condition
&& is_string($key)
?Thank you.
The text was updated successfully, but these errors were encountered: