Tuesday, August 22, 2017

Sharepoint Edit mode catch PostBack type (save, publish, ect.)

PageStateGroupSaveAndStop: means the user clicked "Save"

PageStateGroupSave: means the user clicked "Save and keep editing"

PageStateGroupPublish: means the user clicked "Save and keep editing"

ifPage.Request.Params["__EVENTARGUMENT"] == "PageStateGroupSaveAndStop"   // שמור
  || Page.Request.Params["__EVENTARGUMENT"] == "PageStateGroupSave"       // שמור והמשך עריכה
  || Page.Request.Params["__EVENTARGUMENT"] == "PageStateGroupPublish")   // פרסם
  {






Sharepoint Error Creating a List

activating feature, while provisioning a list (or creating), this happened to us with Genesis:

The filename, directory name, or volume label syntax is incorrect. (Exception from HRESULT: 0x8007007B)

we just has a space in the url

WebRelURL = "Lists/CbsEventsRegistered ", we just removed the last space and the problems was solved.

as a conclusion, this error might indicate just a wrong character somewhere in the list or column settings in the schema.

Sharepoint Updating / Changing Lookup Fields from code

unfortunately the only way to do it correctly is to change the SchemaXml itself for most changes like ListID or ColumnID ect.

here is a Sample:

public static void FixLookup(SPFieldLookup lookupField, Guid newListGuid)
{
   Log.Application.Info("FixLookup");
   if (lookupField.LookupList != newListGuid.ToString())
   {
     Log.Application.Info("update schema");
     int startIndexOfList = lookupField.SchemaXml.IndexOf("List");
     int startIndex = lookupField.SchemaXml.IndexOf("\"", startIndexOfList) + 1;
     int endIndex = lookupField.SchemaXml.IndexOf("\"", startIndex);
     int countIndex = endIndex - startIndex;
     string oldGuid = lookupField.SchemaXml.Substring(startIndex, countIndex);
     lookupField.SchemaXml = lookupField.SchemaXml.Replace(oldGuid, newListGuid.ToString());
     lookupField.Update(true);
   }

   if (lookupField.AllowMultipleValues)
   {
     /// there is a bug either in sp or more likely in the way genesis creates the lookup that without this fix its not working
     Log.Application.Info("toggle AllowMultipleValues");
     lookupField.AllowMultipleValues = false;
     lookupField.Update(true);
     lookupField.AllowMultipleValues = true;
     lookupField.Update(true);
  }
}


Usage

FixLookup(spLookupField, spList.ID);

Sharepoint Bcs to DB no results (Hebrew)

we had a situation where we connected to a db with Hebrew content and we got empty results.

well, 1st of all we removed special characters form the columns name (a dot).

then the Hebrew content we put inside brackets "{}".

Sharepoint Search Crawl error with BotDetect

this is what you may see

The SharePoint server was moved to a different location. ( Error from SharePoint site: HttpStatusCode Redirect The request failed with the error message: --< html><head><title>Object moved</title></head><body>< h2>Object moved to <a href="/_vti_bin/sitedata.asmx?AspxAutoDetectCookieSupport=1">here</a>.</h2>< /body></html> --., CorrelationID: 6f92129d-4742-20cf-86da-6e46bae7318e; SearchID = B83C0CF2-2B3E-4047-AC33-ADD06488B452 )

we dont understand why but it only happens when the BotDetect is configured as AJAX.

the available solutions, Note that for search we usually want only to adapt the admin site:

1. do not activate the capthca on the admin.
2. change the cookieless attribute in the sessionState for the BotDetect to false, like explained here:
http://captcha.com/doc/aspnet/known-issues.html#cookielesscrawlers

more on cookieless:
https://msdn.microsoft.com/en-us/library/system.web.configuration.sessionstatesection.cookieless(v=vs.110).aspx

Sharepoint 2013 search error: The crawler could not communicate with the server

wherever you get this error message in sharepoint 2013 search:

The crawler could not communicate with the server. Check that the server is available and that the firewall access is configured correctly.

the 1st thing that means is that the crawler just failed to get the page.

but before you're running to the IIS and FW, you should just think about Permission.

and that 1st of all means that everything is Published!

Steps:
1. publish everything, incuding Master pages, Page Layouts, ect.
2. make sure the user running the search crawler has Read Permissions to that web.
3. if not the above, do check the IT stuff like communications and FW.

SOAP returns NULL response

many times its just validating the soap response ui
https://www.soapui.org/soap-and-wsdl/validating-soap-services.html