TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bhagyashri Sonar
NA
37
3.2k
existing connection was forcibly closed by the remote host
May 27 2019 9:20 AM
Hello all,
please help i m receiving below error "An existing connection was forcibly closed by the remote host" ocasionally. Mostly inacase of Large items
My code is as below:
public
ListItemCollection GetListItemCollection(
ref
int
p_startOffset,
ref
int
p_endOffset,
SPClientList _list, ClientContext p_ClientContext,
ref
int
p_retry)
//, string[] p_ViewFields)
{
CamlQuery f_caml =
null
;
ListItemCollection f_ListItems =
null
;
// int f_rowLimit = 100;
try
{
try
{
if
(p_ClientContext.HasPendingRequest)
p_ClientContext.ExecuteQuery();
}
catch
(Exception)
{
}
if
(COMMON.StopProcess || COMMON.m_LastErrorCode == LastErrorCode.NetworkNotAvaliable ||
COMMON.m_LastErrorCode == LastErrorCode.NetConnectionDisconnected)
return
null
;
f_caml =
new
CamlQuery();
if
(p_startOffset == 1)
{
f_caml = CamlQuery.CreateAllItemsQuery(p_endOffset);
}
else
f_caml.ViewXml =
""
+
""
+ p_startOffset +
""
+
""
+
""
+ p_endOffset +
""
+
""
+
""
;
f_ListItems = _list.GetItems(f_caml);
///Loads the list item collection
p_ClientContext.Load(f_ListItems);
/// Load the properties of the ListItem
p_ClientContext.Load(f_ListItems, items => items.Include
(
/// Basic properties of the item
item => item.DisplayName,
item => item.ContentType,
item => item.Id,
item => item.FieldValuesAsText,
item => item.Folder,
item => item.Folder.ServerRelativeUrl,
item => item.FieldValuesAsHtml,
///Version fields for the item
item => item.Versions,
item => item.Versions.Include(
ver => ver.VersionId,
ver => ver.VersionLabel,
ver => ver.Fields,
ver => ver.Created,
ver => ver.CreatedBy,
ver => ver.CreatedBy.Email),
item => item.File,
item => item.File.Versions,
item => item.File.MinorVersion,
item => item.File.MajorVersion,
item => item.File.CheckedOutByUser,
item => item.File.CheckedOutByUser.Email,
item => item.File.CheckInComment,
item => item.File.Versions.Include(
ver => ver.CheckInComment,
ver => ver.ID,
ver => ver.Length,
ver => ver.Url,
ver => ver.VersionLabel,
ver => ver.Created,
ver => ver.CreatedBy,
ver => ver.CreatedBy.Email),
///Attachment fields for the item
item => item.AttachmentFiles,
item => item.AttachmentFiles.Include(
attach => attach.FileName,
attach => attach.FileNameAsPath,
attach => attach.ServerRelativePath,
attach => attach.ServerRelativeUrl),
/// Role assignment fields for the item
item => item.RoleAssignments,
item => item.RoleAssignments.Include
(a => a.RoleDefinitionBindings,
a => a.PrincipalId,
a => a.Member,
a => a.Member.Id,
a => a.Member.Title,
a => a.Member.LoginName)));
p_ClientContext.ExecuteQuery();
if
(p_startOffset == 1)
{
int
f_Count = f_ListItems.Count - 1;
p_startOffset = f_ListItems[0].Id;
p_endOffset = f_ListItems[f_Count].Id;
}
}
catch
(Exception ex1)
{
COMMON.ExLogger.LogError(ClassName,
"GetListItemCollection"
, ex1);
if
(!m_ObjChkConnection.InternetConnectionCheck())
{
COMMON.m_LastErrorCode = LastErrorCode.NetworkNotAvaliable;
return
null
;
}
if
(p_retry < 3)
{
Thread.Sleep(1000);
p_retry++;
COMMON.ExLogger.LogError(ClassName,
"GetListItemCollection"
,
"Retry = "
+ p_retry +
" StartOffset = "
+ p_startOffset +
" Endoffset = "
+ p_endOffset);
f_ListItems = GetListItemCollection(
ref
p_startOffset,
ref
p_endOffset, _list, p_ClientContext,
ref
p_retry);
//, p_ViewFields);
}
}
f_caml =
null
;
return
f_ListItems;
}
Reply
Answers (
1
)
Override Icon In Shaarepoint
how to set like/Unlike in document library using SPFX