Click or drag to resize

SurveyFactoryFindByGuid Method

Find a survey using his GUID, return null if not found.

Namespace:  AskiaPortalCmn
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
public static ISurvey FindByGuid(
	IContext context,
	Guid guid
)

Parameters

context
Type: AskiaPortalCmnIContext
Context of execution
guid
Type: SystemGuid
GUID of the survey to find

Return Value

Type: ISurvey
Return null if the survey was not found or if the user within the context doesn't have enough right to access it
Examples

Find the survey using his GUID

var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D"));   
var contextValidation = context.Validate();
if (!contextValidation.Success)
{
    throw contextValidation.Exception;
}
var surveyGuid = Guid.Parse("6F8989A1-5C21-46F1-9A43-556E58137186");
var survey = SurveyFactory.FindByGuid(context, surveyGuid);
if (survey != null)
{
    Console.WriteLine("Survey Guid={0} was found: {1}", survey.Guid, survey.Name);
}
else
{
    Console.WriteLine("The specified survey doesn't exist, or the current user within the context could not access it");
}
See Also