Ejemplo n.º 1
0
        private static async Task <ScItemsResponse> GetItemChildren(ISitecoreItem parentItem)
        {
            using (var credentials = ScNetworkSettings.Credentials())
            {
                using (var session = ScNetworkSettings.Session(credentials))
                {
                    var request = ItemSSCRequestBuilder.ReadChildrenRequestWithId(parentItem.Id)
                                  .Build();

                    var response = await session.ReadChildrenAsync(request);

                    return(response);
                }
            }
        }
Ejemplo n.º 2
0
        private static async Task <ScItemsResponse> GetItemsByQyery(string query)
        {
            using (var credentials = ScNetworkSettings.Credentials())
            {
                using (var session = ScNetworkSettings.Session(credentials))
                {
                    var ext = ExtendedSessionBuilder.ExtendedSessionWith(session)
                              .PathForTemporaryItems("/sitecore/content/Home")
                              .Build();

                    var request = ExtendedSSCRequestBuilder.SitecoreQueryRequest(query)
                                  .PageNumber(0)
                                  .ItemsPerPage(500)                         //max
                                  .Build();

                    var response = await ext.SearchBySitecoreQueryAsync(request);

                    return(response);
                }
            }
        }