I came across this weird issue, running on 7.5.9 assembly: 1.0.6247.17495
when trying to rebuild the Member Index under Dev->Examine and click Optimize, it says it takes too long to execute and check logs.
Logs shows something like
"ERROR UmbracoExamine.DataServices.UmbracoLogService - Provider=InternalMemberIndexer, NodeId=-1
System.Exception: Error indexing queue items,System.FormatException: 17/11/2016 09:17:40 is not a valid value for DateTime. ---> System.FormatException: String was not recognized as a valid DateTime."
I cant seem to locate the which record field as i have 55K records.
For this reason I cant seem to locate the member in Member Picker dialog.
However, if I go to the Member individually and click on Save, then use Member Picker to search it shows this Member record.
So I would like to iterate all members and for each execute Save() command via the API.
What would be the ideal routine for something like that?
..Member.GetAll()..
foreach {
var memberService = Services.MemberService;
var customMember = memberService.GetByEmail(foreachvariable.Email);
memberService.Save(customMember);
}
I have tried using the following but it times out on the GetAll() call
var Members = ApplicationContext.Current.Services.MemberService.GetAll(0, int.MaxValue, out totalRecords);
foreach (var member in Members)
{
var memberService = ApplicationContext.Current.Services.MemberService;
var customMember = memberService.GetByEmail(member.Email);
memberService.Save(customMember);
}
If it's timing out you should consider doing this in smaller batches. The first two parameters to GetAll are pageIndex and pageSize.
So reduce the pageSize to a smaller value (say 500 records) and then, in a loop, increment the pageIndex accordingly until you've iterated all records.
Do you know if there is any way to filter specific type of Member Types for GetAll;
For instance if I wish to iterate all members of Type "Student", what would be the most efficient method?
var students = ApplicationContext.Current.Services.MemberService.GetAll(start, page, out totalRecords);
foreach (var member in Members-Of-Type-Student)
{
...
}
Iterate all Members and Execute Save()
I came across this weird issue, running on 7.5.9 assembly: 1.0.6247.17495
when trying to rebuild the Member Index under Dev->Examine and click Optimize, it says it takes too long to execute and check logs.
Logs shows something like
I cant seem to locate the which record field as i have 55K records.
For this reason I cant seem to locate the member in Member Picker dialog.
However, if I go to the Member individually and click on Save, then use Member Picker to search it shows this Member record.
So I would like to iterate all members and for each execute Save() command via the API.
What would be the ideal routine for something like that?
I have tried using the following but it times out on the GetAll() call
If it's timing out you should consider doing this in smaller batches. The first two parameters to
GetAll
arepageIndex
andpageSize.
So reduce the
pageSize
to a smaller value (say 500 records) and then, in a loop, increment thepageIndex
accordingly until you've iterated all records.I believe these parameters are the same as the underlying provider uses, so see https://msdn.microsoft.com/en-us/library/system.web.security.membershipprovider.getallusers.aspx
Thanks Diplo for the pointers and the link, much appreciated.
I'll give that a try.
cheers!
Hi Diplo
Do you know if there is any way to filter specific type of Member Types for GetAll;
For instance if I wish to iterate all members of Type "Student", what would be the most efficient method?
is working on a reply...