ShareFactoryCreateDefaults Method (IContext, String, Int32, IUser, NullableInt32, NullableGuid) |
Creates default sharing
Namespace:
AskiaPortalCmn
Assembly:
AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax public static IReturnValue CreateDefaults(
IContext context,
string objectType,
int objectId,
IUser user,
Nullable<int> surveyId = null,
Nullable<Guid> moduleGuid = null
)
Public Shared Function CreateDefaults (
context As IContext,
objectType As String,
objectId As Integer,
user As IUser,
Optional surveyId As Nullable(Of Integer) = Nothing,
Optional moduleGuid As Nullable(Of Guid) = Nothing
) As IReturnValue
public:
static IReturnValue^ CreateDefaults(
IContext^ context,
String^ objectType,
int objectId,
IUser^ user,
Nullable<int> surveyId = nullptr,
Nullable<Guid> moduleGuid = nullptr
)
Parameters
- context
- Type: AskiaPortalCmnIContext
Execution context - objectType
- Type: SystemString
Type of the shared object - objectId
- Type: SystemInt32
Id of the shared object - user
- Type: AskiaPortalCmnIUser
The user - surveyId (Optional)
- Type: SystemNullableInt32
Id of the survey - moduleGuid (Optional)
- Type: SystemNullableGuid
GUID of the module
Return Value
Type:
IReturnValue
Returns success result when the process was successfully done.
Examples
Share the AskiaPortal survey by default
if (Convert.ToBoolean(context.User.Settings[SettingsKey.ShareByDefault].Value))
{
var result = ShareFactory.CreateDefaults(context, ShareObjectType.Survey, 12, context.User);
if (!result.Success)
{
Console.Error.WriteLine(result.Exception);
}
}
See Also