public string GetViewHtml(IContent content, Target target)
        {
            if (content == null || content.ContentId == Guid.Empty)
            {
                return(null);
            }

            var library = PublicApi.Libraries.Get(new LibraryGetOptions(content.ContentId));

            if (library == null || library.Id == Guid.Empty)
            {
                return(null);
            }

            var options = new RenderedSearchResultOptions
            {
                Target          = target,
                Title           = library.Name,
                Body            = library.Description,
                Url             = PublicApi.SharePointUrls.BrowseDocuments(library.Id),
                Date            = library.Created,
                ContainerName   = library.Container.HtmlName(target.ToString()),
                ContainerUrl    = library.Container.Url,
                ApplicationName = library.Name,
                ApplicationUrl  = PublicApi.SharePointUrls.BrowseDocuments(library.Id),
                TypeCssClass    = "sharepoint-library",
                User            = content.CreatedByUserId.HasValue ? TEApi.Users.Get(new UsersGetOptions {
                    Id = content.CreatedByUserId.Value
                }) : null,
            };

            return(content.ToRenderedSearchResult(options));
        }
        public string GetViewHtml(IContent content, Target target)
        {
            if (content == null || content.ContentId == Guid.Empty)
            {
                return(null);
            }

            var itemBase = listItemDataService.Get(content.ContentId);

            if (itemBase == null)
            {
                return(null);
            }

            var document = PublicApi.Documents.Get(itemBase.ApplicationId, new DocumentGetOptions(content.ContentId));

            if (document == null || document.HasErrors() || document.ContentId == Guid.Empty)
            {
                return(null);
            }

            var options = new RenderedSearchResultOptions
            {
                Target        = target,
                Title         = document.Title,
                Url           = PublicApi.SharePointUrls.Document(document.ContentId),
                Date          = document.CreatedDate,
                ContainerName = document.Library.Container != null?content.Application.Container.HtmlName(target.ToString()) : null,
                                    ContainerUrl    = document.Library.Container != null ? content.Application.Container.Url : null,
                                    ApplicationName = document.Library.Name,
                                    ApplicationUrl  = PublicApi.SharePointUrls.BrowseDocuments(document.Library.Id),
                                    TypeCssClass    = "sharepoint-document",
                                    User            = content.CreatedByUserId.HasValue ? TEApi.Users.Get(new UsersGetOptions
                {
                    Id = content.CreatedByUserId.Value
                }) : null,
                                    RemoteAttachments = new List <RenderedSearchResultAttachment>
                {
                    new RenderedSearchResultAttachment
                    {
                        FileName = document.Name,
                        Url      = document.DownloadUrl
                    }
                }
            };

            return(content.ToRenderedSearchResult(options));
        }
 public Guid GetContentPermissionId(IContent content)
 {
     return(ContentTypeId);
 }
 public Guid GetSecurableId(IContent content)
 {
     return(content.ContentId);
 }
 public Guid GetSecurableId(IContent content)
 {
     return(content.Application.ApplicationId);
 }