Get versions from item - csom

I am trying to get all versions from an list item and tried following:
$listName = "VersionHistoryStatistics"
Connect-PnPOnline -Url "xxx"
$ctx= Get-PnPContext
$list = $ctx.Web.Lists.GetByTitle($listName)
$item = $list.GetItemById(1);
$versions = $item.Versions
$ctx.Load($list)
$ctx.Load($item)
$ctx.Load($versions)
Error: Cannot find an overload for "Load" and the argument count: "1". Any idea on whats causing this? Its the last line throwing the error.

Figured out it was a mismatch between two PnP versions. After uninstalling all PnP versions and reinstalling it worked.

Related

How to alias a table name?

Since upgrading to Rails 5 I have a query that is not working. It is unable to get results from a table by its alias. The error is that "from" takes zero arguments now. The version of arel is 9.0, the version of Rails is 5.2.4.3
offers = Offer.arel_table
o2 = offers.alias("o2")
seen_offers = offers.from("offers as o2").project(o2[:merchant_id], o2[:display_name])
this is the error:
ArgumentError: wrong number of arguments (given 1, expected 0)
Arel::Table#from takes 0 arguments because it generates a SelectManager:
SelectManager.new(self)
What you are looking for is SelectManager#from and the issue is easily correctable (just switch the project and the from)
offers.project(o2[:merchant_id], o2[:display_name]).from(o2)
project will return a SelectManager and then from will simply change the source

F# tryHead is not defined

I am using Seq.tryHead but I am getting an error
let maybeTagDatabaseModel = Seq.tryHead tagSeq
error
error FS39: The value, constructor, namespace or type 'tryHead' is not defined
Does anyone have suggestions on how to fix? Thanks
For future visitors
The problem seemed to be this dependency "FSharp.Interop.Dynamic": "3.0.0" in the project.json file.
Two of my projects were on version less than 4. Upgraded those and they work now.

CSOM 2013 error: Unable to cast object of type 'System.Collections.Generic.Dictionary

I'm using this code to loop columns of a SharePoint 2013 List.
currentContext.Load(currentList.Fields);
currentContext.ExecuteQuery();
foreach (Field f in currentList.Fields) {
}
No problem with normal columns. But, when I arrive to a lookup column I have this error:
"Unable to cast object of type
'System.Collections.Generic.Dictionary`2[System.String,System.Object]'
to type 'Microsoft.SharePoint.Client.Field'."
I found for example this discussion
This issue came when we were working with TaxonomyFieldValue fields. For us changing references was not an option. This helped:
TaxonomyItem dummy = new TaxonomyItem(web.Context, null);
It will force program to load adequate libraries forcing correct type in runtime.
I had this same issue and updating the references fixed it for me. This question helped me figure it out.
I went from version 14 of "Microsoft.SharePoint.Client" and "Microsoft.SharePoint.Client.Runtime" to version 16 and no longer had the error.
Latest client download

HHVM non-deterministic behaviour of the typechecker

I've noticed that calling hh_client is not always returning correct result. For example: I have following pieces of code:
backend\ConvertMessage.hh:
<?hh // strict
namespace ApiBackend\ConvertMessage {
enum Status: int {
success = 0;
// ... error codes
};
// ... some other classes
};
other place in project:
throw new \SoapFault(
'Server',
\ApiBackend\ConvertMessage\Status::getNames()[$result->status]
);
Sometimes, after doing some changes in project I get following error message: Could not find static method getNames in type ApiBackend\ConvertMessage\Status (Typing[4090])
When I remove a semicolon after one of closing curly brackets, hh_client stops displaying error. But when I insert semicolon back on its place, typechecker still gives me No errors! message.
This is not the only file that causes this problem - it happens to all enums.
It seems to me that it is problem with some cache of either hh_client or hh_server.
Thanks in advance for helping me with solving this problem (and sorry if my english is not too good).
You are probably using an outdated version of HHVM. This problem sounds an awful lot like this race condition, which was fixed in HHVM 3.5.0 and newer (and was backported into the 3.3.3 LTS release). Notably, 3.4.x still had the bug.
What version of HHVM are you using?

SugerCRM Warning: Creating default object from empty value

when i am trying to edit field from sugerCRM editor then i am getting this issue.
even i try to use this patch as well as a solution for this error but still getting this issue.
https://github.com/sugarcrm/sugarcrm_dev/pull/143
( ! ) Warning: Creating default object from empty value in C:\xampp\htdocs\crm\trunk\modules\ModuleBuilder\views\view.modulefield.php on line 151
I found the other answer almost correct but it generated further warnings, this seemed to solve them completely for me:
if(!isset($module->mbvardefs) || is_null($module->mbvardefs)) {
$module->mbvardefs = new stdClass();
}
$module->mbvardefs->vardefs = $dictionary[$objectName];
It is kind of frustrating that SugarCRM comes with bugs like this when using modern versions of PHP..
Thanks friend but this issue is being resolved we just need to replace line number 151 in view.modulefield.php file with
if(!isset($module->mbvardefs) || is_null($module->mbvardefs)) {
$module->mbvardefs = new stdClass();
}
In order for this to work for me, I found that the inserted statement needed to come AFTER the original problem line instead of before it, but big thanks for the solution. This has solved a big headache for me that no-one else seems to have had a pill for!

Resources