This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sitecore.Security.Accounts.User user = Sitecore.Security.Accounts.User.FromName("extranet\Ryan", true); | |
| Sitecore.Security.UserProfile userProfile = user.Profile; | |
| userProfile.SetCustomProperty("Title", "Mr"); // Set the custom property | |
| userProfile.Save(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sitecore.Security.Accounts.User user = Sitecore.Security.Accounts.User.FromName("extranet\Ryan", true); | |
| Sitecore.Security.UserProfile userProfile = user.Profile; | |
| userProfile.SetPropertyValue("ProfileItemId", "{53DAD220-96B3-424C-9ABA-1D14740D7EF6}"); | |
| userProfile.Save(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static string Domain = "extranet"; | |
| public static bool Login(string email, string password) | |
| { | |
| var username = string.Format(@"{0}\{1}", Domain, email); | |
| try | |
| { | |
| if (Sitecore.Security.Authentication.AuthenticationManager.Login(username, password)) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static string Domain = "extranet"; | |
| public static void RegisterUser(string firstName, string lastName, string email, string password) | |
| { | |
| var userName = string.Format(@"{0}\{1}", Domain, email); | |
| try | |
| { | |
| if (!Sitecore.Security.Accounts.User.Exists(userName)) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var index = ContentSearchManager.GetIndex("MySearchIndex"); | |
| using (var context = index.CreateSearchContext()) | |
| { | |
| var searchResults = context.GetQueryable<SearchItem>().Where(x => x.ThumbnailUrl != null) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch"> | |
| <fieldNames hint="raw:AddFieldByFieldName"> | |
| <field fieldName="title" storageType="YES" indexType="TOKENIZED" vectorType="NO" boost="1f" type="System.String" | |
| settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider" | |
| patch:after="field[last()]" /> | |
| </fieldNames> | |
| </fieldMap> | |
| <fields hint="raw:AddComputedIndexField"> | |
| <field fieldName="thumbnail" storageType="yes" indexType="untokenized" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace My.Project.Web.ComputedFields | |
| { | |
| public class ComputedImageField : IComputedIndexField | |
| { | |
| /// <inheritdoc /> | |
| public string FieldName { get; set; } | |
| /// <inheritdoc /> | |
| public string ReturnType { get; set; } | |
| /// <inheritdoc /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
| <sitecore> | |
| <contentSearch> | |
| <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch"> | |
| <indexes hint="list:AddIndex"> | |
| <!-- Change this to Sitecore.ContentSearch.LuceneProvider.SwitchOnRebuildLuceneIndex, Sitecore.ContentSearch.LuceneProvider if you would like indexes to be | |
| built in a temporary directory i.e. while rebuilding is happening, your old indexes work like normal until the rebuild is finished. --> | |
| <index id="NewsSearch" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider"> | |
| <param desc="name">$(id)</param> | |
| <param desc="folder">$(id)</param> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Menu Item | |
| /// </summary> | |
| public class MenuItem | |
| { | |
| /// <summary> | |
| /// Gets or sets the link value. | |
| /// </summary> | |
| public string Link { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var item = Sitecore.Context.Database.GetItem(mediaItemID); | |
| if (item.Paths.IsMediaItem) | |
| { | |
| var mediaItem = new MediaItem(item); | |
| } |